feat: add Node.js version management and improve error handling

- Introduced a .nvmrc file to specify the Node.js version (22) for the project, ensuring consistent development environments.
- Enhanced error handling in the startServer function to provide clearer messages when the Node.js executable cannot be found, improving debugging experience.
- Updated package.json files across various modules to enforce Node.js version compatibility and ensure consistent dependency versions.

These changes aim to streamline development processes and enhance the application's reliability by enforcing version control and improving error reporting.
This commit is contained in:
Test User
2025-12-31 18:42:33 -05:00
parent 2b89b0606c
commit 59bbbd43c5
21 changed files with 387 additions and 269 deletions

View File

@@ -15,6 +15,24 @@ import type {
ModelDefinition,
} from './types.js';
// Automaker-specific environment variables that should not pollute agent processes
// These are internal to Automaker and would interfere with user projects
// (e.g., PORT=3008 would cause Next.js/Vite to use the wrong port)
const AUTOMAKER_ENV_VARS = ['PORT', 'DATA_DIR', 'AUTOMAKER_API_KEY', 'NODE_PATH'];
/**
* Build a clean environment for the SDK, excluding Automaker-specific variables
*/
function buildCleanEnv(): Record<string, string | undefined> {
const cleanEnv: Record<string, string | undefined> = {};
for (const [key, value] of Object.entries(process.env)) {
if (!AUTOMAKER_ENV_VARS.includes(key)) {
cleanEnv[key] = value;
}
}
return cleanEnv;
}
export class ClaudeProvider extends BaseProvider {
getName(): string {
return 'claude';
@@ -57,6 +75,9 @@ export class ClaudeProvider extends BaseProvider {
systemPrompt,
maxTurns,
cwd,
// Pass clean environment to SDK, excluding Automaker-specific variables
// This prevents PORT, DATA_DIR, etc. from polluting agent-spawned processes
env: buildCleanEnv(),
// Only restrict tools if explicitly set OR (no MCP / unrestricted disabled)
...(allowedTools && shouldRestrictTools && { allowedTools }),
...(!allowedTools && shouldRestrictTools && { allowedTools: defaultTools }),