Repository: strapi/strapi
File: packages/core/strapi/src/cli/commands/transfer/command.ts (TypeScript)

Code before:
                type: 'list',
                name: 'direction',
                message: 'Choose transfer direction:',
                choices: [
                  { name: 'Pull data from remote Strapi to local', value: 'from' },
                  { name: 'Push local data to remote Strapi', value: 'to' }
                ]
              }
            ]);

            if (direction === 'from') {
              const { remoteUrl, token } = await inquirer.prompt([
                {
                  type: 'input',
                  name: 'remoteUrl',
                  message: 'Enter the URL of the remote Strapi instance to get data from:',
                  default: process.env.STRAPI_TRANSFER_URL,
                  validate(input) {
                    try {
                      const url = new URL(input);
                      if (!['http:', 'https:'].includes(url.protocol)) {
                        return 'URL must use http: or https: protocol';
                      }
                      return true;
                    } catch (error) {
                      return 'Please enter a valid URL (e.g., http://localhost:1337 or https://example.com)';
                    }
                  }
                },
                {
                  type: 'password',
                  name: 'token',
                  message: 'Enter your transfer token for the remote Strapi source:',
                  default: process.env.STRAPI_TRANSFER_TOKEN,
                  validate(input) {
                    if (!input?.length) {
                      return 'Transfer token is required';
                    }
                    return true;
                  }
                }
              ]);
              opts.from = new URL(remoteUrl);
              opts.fromToken = token;
            } else {
              const { remoteUrl, token } = await inquirer.prompt([
                {
                  type: 'input',
                  name: 'remoteUrl',
                  message: 'Enter the URL of the remote Strapi instance to send data to:',
                  default: process.env.STRAPI_TRANSFER_URL,

Review comment (bug):
```suggestion
                      return 'Please enter a valid URL (e.g., http://localhost:1337/admin or https://example.com/admin)';
```
And eventually we need to make it retry with /admin if it doesn't have it and the initial connection fails

Code after:
          }

          if (hasEnvToken) {
            console.info(
              '   → Environment STRAPI_TRANSFER_TOKEN value will be used as the transfer token'
            );
          }

          console.info(); // Empty line for better readability
        };

        const determineDirection = async () => {
          // If user has not provided a direction from CLI, log the documentation
          if (!opts.from && !opts.to) {
            logDocumentation();
          }

          logEnvironmentVariables();

          if (opts.from) {
            return opts.from;
          }
          if (opts.to) {
            return opts.to;
          }

          const { dir } = await inquirer.prompt([
            {
              type: 'list',
              name: 'dir',
              message: 'Choose transfer direction:',
              choices: [
                { name: 'Pull data from remote Strapi to local', value: 'from' },
                { name: 'Push local data to remote Strapi', value: 'to' },
              ],
            },
          ]);

          return dir;
        };

        const determineUrl = async (direction: 'from' | 'to') => {
          if (opts[direction]) {
            return new URL(opts[direction]);
          }

          if (process.env.STRAPI_TRANSFER_URL) {
            return new URL(process.env.STRAPI_TRANSFER_URL);
          }

          const answer = await inquirer.prompt([