From 860cf4e0e86e774e55c0fca1b74cfc14d3a613e5 Mon Sep 17 00:00:00 2001 From: xpander-ai-coding-agent Date: Wed, 5 Nov 2025 17:04:29 -0800 Subject: [PATCH] feat: add --skip-local-tests flag to deploy command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new --skip-local-tests flag to the xpander deploy command that allows users to skip local Docker container testing and proceed directly to deployment. Changes: - Add --skip-local-tests option to deploy command (src/commands/deploy.ts) - Update deployAgent function to accept skipLocalTests parameter (src/commands/agent/interactive/deploy.ts) - Modify buildAndSaveDockerImage to conditionally skip tests when flag is set (src/utils/custom_agents_utils/docker.ts) Usage: xpander deploy --skip-local-tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/commands/agent/interactive/deploy.ts | 2 ++ src/commands/deploy.ts | 8 +++++++- src/utils/custom_agents_utils/docker.ts | 14 ++++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/commands/agent/interactive/deploy.ts b/src/commands/agent/interactive/deploy.ts index aa004e9..74ac06c 100644 --- a/src/commands/agent/interactive/deploy.ts +++ b/src/commands/agent/interactive/deploy.ts @@ -16,6 +16,7 @@ export async function deployAgent( client: XpanderClient, _agentId?: string, skipDeploymentConfirmation: boolean = false, + skipLocalTests: boolean = false, ) { console.log('\n'); console.log(chalk.bold.blue('✨ Agent deployment')); @@ -78,6 +79,7 @@ export async function deployAgent( deploymentSpinner, currentDirectory, config.agent_id, + skipLocalTests, ); if (!imagePath) { diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index 8236a1c..4f87762 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -14,6 +14,7 @@ export function configureDeployCommand(program: Command): Command { .description('Deploy agent') .option('--profile ', 'Profile to use') .option('--confirm', 'Skip confirmation prompts') + .option('--skip-local-tests', 'Skip local Docker container tests') .action(async (agentId, options) => { const client = createClient(options.profile); @@ -25,7 +26,12 @@ export function configureDeployCommand(program: Command): Command { return; } - await deployAgent(client, resolvedAgentId, options.confirm); + await deployAgent( + client, + resolvedAgentId, + options.confirm, + options.skipLocalTests, + ); }); return operationsCmd; diff --git a/src/utils/custom_agents_utils/docker.ts b/src/utils/custom_agents_utils/docker.ts index 37221cf..fe6ad46 100644 --- a/src/utils/custom_agents_utils/docker.ts +++ b/src/utils/custom_agents_utils/docker.ts @@ -64,12 +64,14 @@ const ensureDockerRunning = async ( * * @param contextPath - Path to the Docker build context (directory with Dockerfile). * @param imageName - Name for the Docker image. + * @param skipLocalTests - If true, skip local Docker container tests. * @returns Full path to the resulting .tar.gz archive. */ export const buildAndSaveDockerImage = async ( deploymentSpinner: ora.Ora, contextPath: string, imageName: string, + skipLocalTests: boolean = false, ): Promise => { const resolvedContext = path.resolve(contextPath); const fullImageName = `${imageName}:latest`; @@ -101,10 +103,14 @@ export const buildAndSaveDockerImage = async ( resolvedContext, ]); - // Test the image locally before proceeding with export - const testPassed = await testDockerImage(deploymentSpinner, imageName, 10); - if (!testPassed) { - return; + // Test the image locally before proceeding with export (unless skipped) + if (!skipLocalTests) { + const testPassed = await testDockerImage(deploymentSpinner, imageName, 10); + if (!testPassed) { + return; + } + } else { + deploymentSpinner.text = 'Skipping local tests (--skip-local-tests flag)'; } deploymentSpinner.text = 'Exporting your AI Agent files';