From 79bf1c9bec93bf8eda83c00d27de89ae243d267e Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 31 Dec 2025 21:07:26 -0500 Subject: [PATCH] feat: add centralized build validation command and refactor port configuration - Introduced a new command for validating project builds, providing detailed instructions for running builds and intelligently fixing failures based on recent changes. - Refactored port configuration by centralizing it in the @automaker/types package for improved maintainability and backward compatibility. - Updated imports in various modules to reflect the new centralized port configuration, ensuring consistent usage across the application. --- .claude/commands/validate-build.md | 49 ++++++++++++++++++++++++++++++ libs/platform/src/config/ports.ts | 13 ++------ libs/prompts/package.json | 1 - libs/prompts/src/defaults.ts | 2 +- libs/types/src/index.ts | 3 ++ libs/types/src/ports.ts | 15 +++++++++ 6 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 .claude/commands/validate-build.md create mode 100644 libs/types/src/ports.ts diff --git a/.claude/commands/validate-build.md b/.claude/commands/validate-build.md new file mode 100644 index 00000000..790992b1 --- /dev/null +++ b/.claude/commands/validate-build.md @@ -0,0 +1,49 @@ +# Project Build and Fix Command + +Run all builds and intelligently fix any failures based on what changed. + +## Instructions + +1. **Run the build** + + ```bash + npm run build + ``` + + This builds all packages and the UI application. + +2. **If the build succeeds**, report success and stop. + +3. **If the build fails**, analyze the failures: + - Note which build step failed and the error messages + - Check for TypeScript compilation errors, missing dependencies, or configuration issues + - Run `git diff main` to see what code has changed + +4. **Determine the nature of the failure**: + - **If the failure is due to intentional changes** (new features, refactoring, dependency updates): + - Fix any TypeScript type errors introduced by the changes + - Update build configuration if needed (e.g., tsconfig.json, vite.config.mts) + - Ensure all new dependencies are properly installed + - Fix import paths or module resolution issues + + - **If the failure appears to be a regression** (broken imports, missing files, configuration errors): + - Fix the source code to restore the build + - Check for accidentally deleted files or broken references + - Verify build configuration files are correct + +5. **Common build issues to check**: + - **TypeScript errors**: Fix type mismatches, missing types, or incorrect imports + - **Missing dependencies**: Run `npm install` if packages are missing + - **Import/export errors**: Fix incorrect import paths or missing exports + - **Build configuration**: Check tsconfig.json, vite.config.mts, or other build configs + - **Package build order**: Ensure `build:packages` completes before building apps + +6. **How to decide if it's intentional vs regression**: + - Look at the git diff and commit messages + - If the change was deliberate and introduced new code that needs fixing → fix the new code + - If the change broke existing functionality that should still build → fix the regression + - When in doubt, ask the user + +7. **After making fixes**, re-run the build to verify everything compiles successfully. + +8. **Report summary** of what was fixed (TypeScript errors, configuration issues, missing dependencies, etc.). diff --git a/libs/platform/src/config/ports.ts b/libs/platform/src/config/ports.ts index 451ecdd7..1089e966 100644 --- a/libs/platform/src/config/ports.ts +++ b/libs/platform/src/config/ports.ts @@ -1,15 +1,8 @@ /** * 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. + * Re-exports from @automaker/types for backward compatibility. + * The canonical definition is in @automaker/types to allow browser-safe imports. */ -/** 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; +export { STATIC_PORT, SERVER_PORT, RESERVED_PORTS } from '@automaker/types'; diff --git a/libs/prompts/package.json b/libs/prompts/package.json index 8de01d9b..0012859f 100644 --- a/libs/prompts/package.json +++ b/libs/prompts/package.json @@ -22,7 +22,6 @@ "node": ">=22.0.0 <23.0.0" }, "dependencies": { - "@automaker/platform": "1.0.0", "@automaker/types": "1.0.0" }, "devDependencies": { diff --git a/libs/prompts/src/defaults.ts b/libs/prompts/src/defaults.ts index 57646330..c0ae7e0b 100644 --- a/libs/prompts/src/defaults.ts +++ b/libs/prompts/src/defaults.ts @@ -16,7 +16,7 @@ import type { ResolvedBacklogPlanPrompts, ResolvedEnhancementPrompts, } from '@automaker/types'; -import { STATIC_PORT, SERVER_PORT } from '@automaker/platform'; +import { STATIC_PORT, SERVER_PORT } from '@automaker/types'; /** * ======================================================================== diff --git a/libs/types/src/index.ts b/libs/types/src/index.ts index 30a903e1..be714877 100644 --- a/libs/types/src/index.ts +++ b/libs/types/src/index.ts @@ -140,3 +140,6 @@ export type { PipelineStatus, FeatureStatusWithPipeline, } from './pipeline.js'; + +// Port configuration +export { STATIC_PORT, SERVER_PORT, RESERVED_PORTS } from './ports.js'; diff --git a/libs/types/src/ports.ts b/libs/types/src/ports.ts new file mode 100644 index 00000000..451ecdd7 --- /dev/null +++ b/libs/types/src/ports.ts @@ -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;