Fix noise in headless mode on STDOUT (#1184)

This commit is contained in:
Allen Hutchison 2025-06-18 11:40:15 -07:00 committed by GitHub
parent 589a7b59c6
commit fbc79c34c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 2 deletions

View File

@ -30,7 +30,6 @@ import {
export async function main() {
const workspaceRoot = process.cwd();
const settings = loadSettings(workspaceRoot);
setWindowTitle(basename(workspaceRoot), settings);
await cleanupCheckpoints();
if (settings.errors.length > 0) {
@ -84,6 +83,7 @@ export async function main() {
// Render UI, passing necessary config values. Check that there is no command line question.
if (process.stdin.isTTY && input?.length === 0) {
setWindowTitle(basename(workspaceRoot), settings);
render(
<React.StrictMode>
<AppWrapper

View File

@ -27,6 +27,11 @@ function getResponseText(response: GenerateContentResponse): string | null {
candidate.content.parts &&
candidate.content.parts.length > 0
) {
// We are running in headless mode so we don't need to return thoughts to STDOUT.
const thoughtPart = candidate.content.parts[0];
if (thoughtPart?.thought) {
return null;
}
return candidate.content.parts
.filter((part) => part.text)
.map((part) => part.text)

View File

@ -203,6 +203,7 @@ export async function start_sandbox(config: SandboxConfig) {
);
process.exit(1);
}
// Log on STDERR so it doesn't clutter the output on STDOUT
console.error(`using macos seatbelt (profile: ${profile}) ...`);
// if DEBUG is set, convert to --inspect-brk in NODE_OPTIONS
const args = [

View File

@ -49,7 +49,8 @@ export class GitIgnoreParser implements GitIgnoreFilter {
.map((p) => p.trim())
.filter((p) => p !== '' && !p.startsWith('#'));
if (patterns.length > 0) {
console.log(
// Log the number of patterns loaded on STDERR so it doesn't clutter the output on STDOUT
console.error(
`Loaded ${patterns.length} patterns from ${patternsFilePath}`,
);
}