feat: add test validation command and improve environment variable handling

- Introduced a new command for validating tests, providing detailed instructions for running tests and fixing failures based on code changes.
- Updated the environment variable handling in the Claude provider to only allow explicitly defined variables, enhancing security and preventing leakage of sensitive information.
- Improved feature loading to handle errors more gracefully and load features concurrently, optimizing performance.
- Centralized port configuration for the Automaker application to prevent accidental termination of critical services.
This commit is contained in:
Test User
2025-12-31 20:36:20 -05:00
parent 3f4f2199eb
commit 2828431cca
9 changed files with 98 additions and 39 deletions

View File

@@ -0,0 +1,15 @@
/**
* Centralized port configuration for AutoMaker
*
* These ports are reserved for the Automaker application and should never be
* killed or terminated by AI agents during feature implementation.
*/
/** Port for the static/UI server (Vite dev server) */
export const STATIC_PORT = 3007;
/** Port for the backend API server (Express + WebSocket) */
export const SERVER_PORT = 3008;
/** Array of all reserved Automaker ports */
export const RESERVED_PORTS = [STATIC_PORT, SERVER_PORT] as const;

View File

@@ -115,3 +115,6 @@ export {
electronAppStat,
electronAppReadFile,
} from './system-paths.js';
// Port configuration
export { STATIC_PORT, SERVER_PORT, RESERVED_PORTS } from './config/ports.js';

View File

@@ -574,11 +574,11 @@ export function removeEnvKeySync(envPath: string, key: string): void {
*/
function updateEnvContent(content: string, key: string, value: string): string {
const lines = content.split('\n');
const keyRegex = new RegExp(`^${escapeRegex(key)}=`);
const keyPrefix = `${key}=`;
let found = false;
const newLines = lines.map((line) => {
if (keyRegex.test(line.trim())) {
if (line.trim().startsWith(keyPrefix)) {
found = true;
return `${key}=${value}`;
}
@@ -612,8 +612,8 @@ function updateEnvContent(content: string, key: string, value: string): string {
*/
function removeEnvKeyFromContent(content: string, key: string): string {
const lines = content.split('\n');
const keyRegex = new RegExp(`^${escapeRegex(key)}=`);
const newLines = lines.filter((line) => !keyRegex.test(line.trim()));
const keyPrefix = `${key}=`;
const newLines = lines.filter((line) => !line.trim().startsWith(keyPrefix));
// Remove trailing empty lines
while (newLines.length > 0 && newLines[newLines.length - 1].trim() === '') {
@@ -627,10 +627,3 @@ function removeEnvKeyFromContent(content: string, key: string): string {
}
return result;
}
/**
* Escape special regex characters in a string
*/
function escapeRegex(str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

View File

@@ -22,6 +22,7 @@
"node": ">=22.0.0 <23.0.0"
},
"dependencies": {
"@automaker/platform": "1.0.0",
"@automaker/types": "1.0.0"
},
"devDependencies": {

View File

@@ -16,6 +16,7 @@ import type {
ResolvedBacklogPlanPrompts,
ResolvedEnhancementPrompts,
} from '@automaker/types';
import { STATIC_PORT, SERVER_PORT } from '@automaker/platform';
/**
* ========================================================================
@@ -210,7 +211,7 @@ This feature depends on: {{dependencies}}
{{/if}}
**CRITICAL - Port Protection:**
NEVER kill or terminate processes running on ports 3007 or 3008. These are reserved for the Automaker application. Killing these ports will crash Automaker and terminate this session.
NEVER kill or terminate processes running on ports ${STATIC_PORT} or ${SERVER_PORT}. These are reserved for the Automaker application. Killing these ports will crash Automaker and terminate this session.
`;
export const DEFAULT_AUTO_MODE_FOLLOW_UP_PROMPT_TEMPLATE = `## Follow-up on Feature Implementation
@@ -303,7 +304,7 @@ You have access to several tools:
5. Guide users toward good software design principles
**CRITICAL - Port Protection:**
NEVER kill or terminate processes running on ports 3007 or 3008. These are reserved for the Automaker application itself. Killing these ports will crash Automaker and terminate your session.
NEVER kill or terminate processes running on ports ${STATIC_PORT} or ${SERVER_PORT}. These are reserved for the Automaker application itself. Killing these ports will crash Automaker and terminate your session.
Remember: You're a collaborative partner in the development process. Be helpful, clear, and thorough.`;