chore(agents): update agents logging guidelines for TUI vs console
This commit is contained in:
@@ -174,9 +174,9 @@ To change an entry, fix the source:
|
||||
|
||||
Regenerate with `bun run gen:models` and commit `models.json` alongside the source change. Add a regression test against the **resolver/descriptor**, not the bundled JSON, so it survives upstream metadata shifts.
|
||||
|
||||
## Logging
|
||||
## Logging and CLI Output
|
||||
|
||||
**NEVER use `console.log`/`error`/`warn`** in the coding-agent package — it corrupts TUI rendering. Use the centralized logger:
|
||||
Code that may run while the TUI, RPC, SDK, workers, or background runtimes are active MUST NOT use `console.log`/`error`/`warn`; it corrupts rendering or protocols. Use the centralized logger:
|
||||
|
||||
```typescript
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
@@ -186,7 +186,7 @@ logger.warn("Theme file invalid, using fallback", { path });
|
||||
logger.debug("LSP fallback triggered", { reason });
|
||||
```
|
||||
|
||||
Logs go to `~/.omp/logs/omp.YYYY-MM-DD.log` with automatic rotation.
|
||||
Logs go to `~/.omp/logs/omp.YYYY-MM-DD.log` with automatic rotation. Standalone CLI commands that exit without entering the TUI MAY use `console.*` or process streams for intentional user-facing output. Keep structured stdout clean. This exception is semantic, not filename-based; shared code must use `logger` or an explicit output sink.
|
||||
|
||||
## TUI Sanitization
|
||||
|
||||
|
||||
Reference in New Issue
Block a user