tycono 0.1.96-beta.53 → 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 +3 -2
- package/package.json +1 -1
- package/src/api/src/create-server.ts +5 -1
package/bin/tycono.ts
CHANGED
|
@@ -222,8 +222,9 @@ async function startServerForTui(): Promise<void> {
|
|
|
222
222
|
const origLog = (...args: unknown[]) => origStdoutWrite(args.join(' ') + '\n');
|
|
223
223
|
|
|
224
224
|
// Redirect console methods to log file BEFORE importing server code
|
|
225
|
-
//
|
|
226
|
-
// Ink needs full control
|
|
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
|
|
227
228
|
console.log = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
228
229
|
console.error = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
229
230
|
console.warn = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
package/package.json
CHANGED
|
@@ -227,8 +227,12 @@ export function createExpressApp(): express.Application {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
app.use((err: Error, req: express.Request, res: express.Response, _next: express.NextFunction) => {
|
|
230
|
-
console.error(`[ERROR] ${req.method} ${req.url} — ${err.message}`);
|
|
231
230
|
const status = err.name === 'FileNotFoundError' ? 404 : 500;
|
|
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
|
|
233
|
+
if (status >= 500) {
|
|
234
|
+
console.error(`[ERROR] ${req.method} ${req.url} — ${err.message}`);
|
|
235
|
+
}
|
|
232
236
|
res.status(status).json({ error: err.message });
|
|
233
237
|
});
|
|
234
238
|
|