feat: add --force option to regenerate content even if unchanged#9
feat: add --force option to regenerate content even if unchanged#9
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Config
participant Generator
participant Filesystem
User->>CLI: run `generate --force` or without
CLI->>Config: parse options (include force)
Config-->>CLI: resolved config (force: true|false)
CLI->>Generator: invoke generate with config
Generator->>Filesystem: read file content
alt config.force is false
Generator->>Generator: extractExistingAudioData(content)
Generator-->>Generator: if hash/voice match -> skip generation
else config.force is true
Generator-->>Generator: skip extraction (force override)
Generator->>Filesystem: proceed to generate/update audio
end
Generator->>Filesystem: write/update file (when generating)
Generator-->>CLI: result/status
CLI-->>User: print outcome
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a --force option to the generate command so users can regenerate TTS audio and reinject the MDX component even when the content hash and voice IDs indicate nothing has changed.
Changes:
- Introduces
forceinGenerateOptionsandResolvedConfig. - Wires
--forcethrough the CLI and config resolution. - Updates generate skip logic to respect
--force.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/types/index.ts | Adds force?: boolean to GenerateOptions typing. |
| src/core/config.ts | Adds force to resolved config and sets a default. |
| src/commands/generate.ts | Bypasses “content unchanged” skipping when --force is set. |
| src/cli.ts | Exposes --force CLI flag for the generate command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/commands/generate.ts
Outdated
| // Check if file already has audio component with hash | ||
| const existingData = await extractExistingAudioData(content, config.componentName); | ||
|
|
||
| // If component exists with matching hash and voice IDs, skip | ||
| if (existingData) { | ||
| // If component exists with matching hash and voice IDs, skip (unless --force) | ||
| if (existingData && !config.force) { |
There was a problem hiding this comment.
When --force is enabled, we still call extractExistingAudioData(...), which parses the MDX AST and can be relatively expensive. Consider short-circuiting this (e.g., only extracting existing data when !config.force) to avoid unnecessary work on large docs sets.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
|
@twangodev I've opened a new pull request, #10, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: twangodev <48845764+twangodev@users.noreply.github.com>
Co-authored-by: twangodev <48845764+twangodev@users.noreply.github.com>
Summary by CodeRabbit