Default NODE_ENV to development (#139)

This commit is contained in:
Chris Estreich 2025-06-26 13:24:09 -07:00 committed by GitHub
parent 5edb2f8bb6
commit 4d4e218575
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 38 deletions

View file

@ -9,9 +9,11 @@
"dev": "dotenvx run -f ../../.env.development -- next dev --turbopack --port 3001",
"build": "dotenvx run -f ../../.env.production -- next build",
"start": "dotenvx run -f ../../.env.production -- next start --port 3001",
"worker": "dotenvx run -f ../../.env.development -- tsx src/lib/worker.ts",
"controller": "dotenvx run -f ../../.env.development -- tsx src/lib/controller.ts",
"cli": "dotenvx run -f ../../.env.development -- tsx src/cli.ts",
"controller:production": "dotenvx run -f ../../.env.production -- tsx src/lib/controller.ts",
"worker": "dotenvx run -f ../../.env.development -- tsx src/lib/worker.ts",
"worker:production": "dotenvx run -f ../../.env.production -- tsx src/lib/worker.ts",
"cli": "dotenvx run -f ../../.env.development -- tsx src/lib/cli.ts",
"clean": "rimraf .next .turbo"
},
"dependencies": {

View file

@ -21,12 +21,6 @@ import {
import { runTask } from '@/lib/runTask';
import { Logger } from '@/lib/logger';
const logger = new Logger({
logDir: path.resolve(os.tmpdir(), 'logs'),
filename: 'cli.log',
tag: 'worker',
});
const fixIssueCommand = command({
name: 'fix-issue',
description: 'Fix a GitHub issue',
@ -76,10 +70,8 @@ const fixIssueCommand = command({
const result = await fixGitHubIssue(payload);
console.log('✅ Issue fix completed successfully!');
console.log(`Repository: ${result.repo}`);
console.log(`Issue: #${result.issue}`);
console.log('Result:', result.result);
console.log('✅ Issue fix completed successfully!', result);
process.exit(0);
} catch (error) {
console.error('❌ Error fixing issue:', error);
process.exit(1);
@ -149,9 +141,8 @@ const respondIssueCommentCommand = command({
};
const result = await processIssueComment(payload);
console.log('✅ Issue comment response completed successfully!');
console.log('Result:', result);
console.log('✅ Issue comment response completed successfully!', result);
process.exit(0);
} catch (error) {
console.error('❌ Error responding to issue comment:', error);
process.exit(1);
@ -248,9 +239,8 @@ const respondPrCommentCommand = command({
};
const result = await processPullRequestComment(payload);
console.log('✅ PR comment response completed successfully!');
console.log('Result:', result);
console.log('✅ PR comment response completed successfully!', result);
process.exit(0);
} catch (error) {
console.error('❌ Error responding to PR comment:', error);
process.exit(1);
@ -283,28 +273,34 @@ const promptCommand = command({
throw new Error('Invalid mode');
}
console.log(`${text} (${mode}) in ${workspacePath}`);
await runTask({
jobType: 'test.prompt',
jobPayload: { text },
prompt: text,
logger,
logger: new Logger({
logDir: path.resolve(os.tmpdir(), 'logs'),
filename: 'cli.log',
tag: 'worker',
}),
notify: false,
workspacePath,
settings: { mode },
});
process.exit(0);
},
});
// Example:
// pnpm --filter @roo-code-cloud/roomote cli prompt --text "What time is it?" --mode ask --workspace-path ~/Documents/Roo-Code
const app = subcommands({
name: 'roomote-cli',
description: 'Roomote CLI - Run jobs directly from the command line',
cmds: {
'fix-issue': fixIssueCommand,
'respond-issue-comment': respondIssueCommentCommand,
'respond-pr-comment': respondPrCommentCommand,
prompt: promptCommand,
[fixIssueCommand.name]: fixIssueCommand,
[respondIssueCommentCommand.name]: respondIssueCommentCommand,
[respondPrCommentCommand.name]: respondPrCommentCommand,
[promptCommand.name]: promptCommand,
},
});

View file

@ -82,15 +82,6 @@ export const runTask = async <T extends JobType>({
logger.info(codeCommand);
// Sleep for a random amount of time between 5 and 10 seconds, unless we're
// running in a container, in which case there are no issues with flooding
// VSCode with new windows.
if (!containerized) {
await new Promise((resolve) =>
setTimeout(resolve, Math.random() * 5_000 + 5_000),
);
}
const subprocess = execa({
env,
shell: '/bin/bash',
@ -100,8 +91,6 @@ export const runTask = async <T extends JobType>({
// If debugging, add `--verbose` to `command` and uncomment the following line.
// subprocess.stdout.pipe(process.stdout)
// Give VSCode some time to spawn before connecting to its unix socket.
await new Promise((resolve) => setTimeout(resolve, 3_000));
let client: IpcClient | undefined = undefined;
let attempts = 5;
@ -219,10 +208,10 @@ export const runTask = async <T extends JobType>({
configuration: {
...EVALS_SETTINGS,
openRouterApiKey: process.env.OPENROUTER_API_KEY,
lastShownAnnouncementId: 'jun-17-2025-3-21',
...settings,
},
text: prompt,
newTab: true,
},
});

View file

@ -15,7 +15,7 @@ export const Env = createEnv({
client: {},
// You need to destructure all the keys manually.
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
NODE_ENV: process.env.NODE_ENV || 'development',
DATABASE_URL: process.env.DATABASE_URL,
REDIS_URL: process.env.REDIS_URL,
CLICKHOUSE_URL: process.env.CLICKHOUSE_URL,