Skip to content

Conversation

@SouravVerma-art
Copy link

  • add --dry-run flag to preview translation tasks without execution
  • show detailed file analysis: source/target strings, changes breakdown
  • display summary with total strings to translate
  • skip authentication and API initialization in dry-run mode
  • support all existing filter flags (--target-locale, --bucket, --file, --key)

this feature allows users to:

  • preview which files would be translated
  • see how many strings would be affected
  • estimate potential costs before running actual translation
  • verify configuration without making changes

- add --dry-run flag to preview translation tasks without execution
- show detailed file analysis: source/target strings, changes breakdown
- display summary with total strings to translate
- skip authentication and API initialization in dry-run mode
- support all existing filter flags (--target-locale, --bucket, --file, --key)

this feature allows users to:
- preview which files would be translated
- see how many strings would be affected
- estimate potential costs before running actual translation
- verify configuration without making changes
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a --dry-run flag to the CLI run command, allowing users to preview translation tasks before execution. The implementation intelligently skips authentication, API initialization, and actual translation while providing detailed analysis of what would be translated.

Key Changes:

  • Added --dry-run flag to preview translation operations without execution
  • Implemented comprehensive file analysis showing source/target string counts and change breakdowns
  • Conditionally skip authentication and localization provider initialization in dry-run mode

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/cli/src/cli/cmd/run/_types.ts Added dryRun boolean flag to the schema with default value false
packages/cli/src/cli/cmd/run/index.ts Added --dry-run option and branching logic to invoke dry-run mode instead of execution/frozen checks
packages/cli/src/cli/cmd/run/setup.ts Modified setup tasks to skip localization provider selection, authentication, validation, and initialization when dryRun flag is enabled
packages/cli/src/cli/cmd/run/dry-run.ts New module implementing dry-run analysis with detailed file-by-file breakdown and summary of translation requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +157 to +160
// If dry-run mode is enabled, skip execution and show preview
if (ctx.flags.dryRun) {
await dryRun(ctx);
await renderSpacer();
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch mode (line 178) may not work correctly when combined with --dry-run since ctx.localizer will be null in dry-run mode. The watch mode's triggerRetranslation function calls execute() which requires a valid localizer. Consider adding a check like if (ctx.flags.dryRun && ctx.flags.watch) to either prevent this combination or document the expected behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +105 to +116
} catch (error: any) {
results.push({
task: assignedTask,
sourceCount: 0,
targetCount: 0,
added: 0,
updated: 0,
renamed: 0,
removed: 0,
toTranslate: 0,
});
}
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors are silently caught and converted to zero-value results, making it difficult to distinguish between a file with no translations and a file that failed to load. Consider logging the error or showing a warning in the output to help users identify configuration or file access issues. For example: console.warn(chalk.yellow(\⚠ Failed to analyze ${assignedTask.bucketPathPattern}: ${error.message}`))`

Copilot uses AI. Check for mistakes.
Comment on lines +162 to +165
const displayPath = result.task.bucketPathPattern.replace(
"[locale]",
result.task.targetLocale,
);
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable displayPath.

Suggested change
const displayPath = result.task.bucketPathPattern.replace(
"[locale]",
result.task.targetLocale,
);

Copilot uses AI. Check for mistakes.
@sumitsaurabh927
Copy link
Contributor

@SouravVerma-art please resolve comments

@sumitsaurabh927
Copy link
Contributor

@SouravVerma-art please go through the comments and resolve them

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Hey @SouravVerma-art! Just checking in - are you still working on this PR? We noticed there are some comments that may need addressing. If you need more time, no problem! Just let us know. If we don't hear back within a week, we'll close this to keep the repo tidy, but you can always reopen when ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants