tycono 0.1.96-beta.54 → 0.1.96-beta.55
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 +4 -8
- package/package.json +1 -1
- package/src/api/src/create-server.ts +3 -2
package/bin/tycono.ts
CHANGED
|
@@ -221,18 +221,14 @@ async function startServerForTui(): Promise<void> {
|
|
|
221
221
|
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
222
222
|
const origLog = (...args: unknown[]) => origStdoutWrite(args.join(' ') + '\n');
|
|
223
223
|
|
|
224
|
-
// Redirect
|
|
225
|
-
//
|
|
224
|
+
// Redirect console methods to log file BEFORE importing server code
|
|
225
|
+
// ⛔ Do NOT redirect process.stdout.write or process.stderr.write
|
|
226
|
+
// stdout.write: Ink needs full control for rendering
|
|
227
|
+
// stderr.write: Node.js http client uses it internally — redirect breaks HTTP
|
|
226
228
|
console.log = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
227
229
|
console.error = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
228
230
|
console.warn = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
229
231
|
console.info = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
230
|
-
// Also redirect stderr.write — some code uses process.stderr directly
|
|
231
|
-
const origStderrWrite = process.stderr.write.bind(process.stderr);
|
|
232
|
-
process.stderr.write = ((chunk: any, ...args: any[]) => {
|
|
233
|
-
logStream.write(typeof chunk === 'string' ? chunk : chunk.toString());
|
|
234
|
-
return true;
|
|
235
|
-
}) as any;
|
|
236
232
|
|
|
237
233
|
const { createHttpServer } = await import('../src/api/src/create-server.js');
|
|
238
234
|
const server = createHttpServer();
|
package/package.json
CHANGED
|
@@ -228,9 +228,10 @@ export function createExpressApp(): express.Application {
|
|
|
228
228
|
|
|
229
229
|
app.use((err: Error, req: express.Request, res: express.Response, _next: express.NextFunction) => {
|
|
230
230
|
const status = err.name === 'FileNotFoundError' ? 404 : 500;
|
|
231
|
-
// Log errors
|
|
231
|
+
// Log server errors via console.error (redirected to log file in TUI mode)
|
|
232
|
+
// 404 errors are expected (e.g. fresh install, no company.md) — skip
|
|
232
233
|
if (status >= 500) {
|
|
233
|
-
|
|
234
|
+
console.error(`[ERROR] ${req.method} ${req.url} — ${err.message}`);
|
|
234
235
|
}
|
|
235
236
|
res.status(status).json({ error: err.message });
|
|
236
237
|
});
|