Repository: MotiaDev/motia
File: packages/snap/src/cloud/cli/deploy.ts (TypeScript)

Code before:
import { buildValidation } from '../build/build-validation'
import { cloudCli } from '../cli'
import { handler } from '../config-utils'
import { build } from '../new-deployment/build'
import { cloudApi } from '../new-deployment/cloud-api'
import { deploy } from '../new-deployment/deploy'
import { CliListener } from '../new-deployment/listeners/cli-listener'
import { uploadArtifacts } from '../new-deployment/upload-artifacts'
import { loadEnvData } from '../new-deployment/utils/load-env-data'

cloudCli
  .command('deploy')
  .description('Deploy a new version to Motia Cloud')
  .requiredOption('-k, --api-key <key>', 'The API key for authentication', process.env.MOTIA_API_KEY)
  .requiredOption('-v, --version-name <version>', 'The version to deploy')
  .option('-p, --project-id <id>', 'Project ID', process.env.MOTIA_PROJECT_ID)
  .option('-s, --environment-id <id>', 'Environment ID', process.env.MOTIA_ENVIRONMENT_ID)
  .option('-e, --env-file <path>', 'Path to environment file')
  .option('-n, --project-name <name>', 'Project name (used when environment-id is not provided)', process.env.MOTIA_PROJECT_NAME)
  .action(
    handler(async (arg, context) => {
      const listener = new CliListener(context)
      const builder = await build(listener)
      const isValid = buildValidation(builder, listener)

      if (!isValid) {
        process.exit(1)
      }

      context.log('build-completed', (message) => message.tag('success').append('Build completed'))
      context.log('creating-deployment', (message) => message.tag('progress').append('Creating deployment...'))

      const deployment = await cloudApi
        .createDeployment({
          apiKey: arg.apiKey,
          versionName: arg.versionName,
          environmentId: arg.environmentId,
          projectName: arg.projectName,
        })
        .catch((error) => {
          context.log('creating-deployment', (message) => message.tag('failed').append('Failed to create deployment'))
          throw error
        })


Review comment (suggestion):
```suggestion
  .option('-n, --project-name <name>', 'Project name (used when creating a new project)', '')
```

Code after:
import { buildValidation } from '../build/build-validation'
import { cloudCli } from '../cli'
import { handler } from '../config-utils'
import { build } from '../new-deployment/build'
import { cloudApi } from '../new-deployment/cloud-api'
import { deploy } from '../new-deployment/deploy'
import { CliListener } from '../new-deployment/listeners/cli-listener'
import { uploadArtifacts } from '../new-deployment/upload-artifacts'
import { loadEnvData } from '../new-deployment/utils/load-env-data'

cloudCli
  .command('deploy')
  .description('Deploy a new version to Motia Cloud')
  .requiredOption('-k, --api-key <key>', 'The API key for authentication', process.env.MOTIA_API_KEY)
  .requiredOption('-v, --version-name <version>', 'The version to deploy')
  .option('-p, --project-id <id>', 'Project ID (Deprecated)')
  .option('-s, --environment-id <id>', 'Environment ID', process.env.MOTIA_ENVIRONMENT_ID)
  .option('-e, --env-file <path>', 'Path to environment file')
  .option('-n, --project-name <name>', 'Project name (used when creating a new project)', '')
  .action(
    handler(async (arg, context) => {
      const listener = new CliListener(context)
      const builder = await build(listener)
      const isValid = buildValidation(builder, listener)

      if (!isValid) {
        process.exit(1)
      }

      context.log('build-completed', (message) => message.tag('success').append('Build completed'))
      context.log('creating-deployment', (message) => message.tag('progress').append('Creating deployment...'))

      const deployment = await cloudApi
        .createDeployment({
          apiKey: arg.apiKey,
          versionName: arg.versionName,
          environmentId: arg.environmentId,
          projectName: arg.projectName,
        })
        .catch((error) => {
          context.log('creating-deployment', (message) => message.tag('failed').append('Failed to create deployment'))
          throw error
        })