Fix CLI error double-wrapping, config read side effect, and stale flag docs - #34
Merged
Conversation
…g docs - icon: re-throw oclif CLIErrors instead of re-wrapping them as 'Failed to generate icon: ...' (validation errors printed twice-nested) - icon: validate --quality for banana-2 in --prompt-only so the preview matches generation-mode behavior - icon: fix stale '(GPT-Image-1 only)' flag descriptions that apply to all OpenAI models - config service: don't create an empty ~/.snapai/config.json as a side effect of read-only commands like 'snapai config --show' - openai service: remove dead 'rawPrompt ? prompt : prompt' ternary - package.json: remove broken test:icon-batch script (script file does not exist in the repo) - webpack: add @google/genai and mime to externals like the other runtime dependencies Co-authored-by: Beto <betomoedano@users.noreply.github.com>
betomoedano
marked this pull request as ready for review
July 16, 2026 00:28
…xes-9214 # Conflicts: # src/commands/icon.ts Co-authored-by: Beto <betomoedano@users.noreply.github.com>
- re-throw oclif CLIErrors instead of double-wrapping them as 'Failed to generate feature graphic: ...' (same bug as icon command) - validate provider-specific constraints (-n limits, --quality) in --prompt-only mode so the preview matches generation behavior Co-authored-by: Beto <betomoedano@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Routine bug-scan pass over the codebase. Fixes several small but real bugs; no behavior additions.
Bug fixes
Double-wrapped error messages (
src/commands/icon.ts,src/commands/feature-graphic.ts): everythis.error(...)insiderun()throws an oclifCLIErrorthat was caught by the outercatchand re-wrapped asFailed to generate icon: <original red message>. For example,snapai icon -p x --model banana -n 2printed a nested, double-styled message. The catch now re-throwsCLIErrors as-is and only wraps unexpected errors (API failures, save failures).Before:
After:
Config file created on read (
src/services/config.ts):getConfig()calledfs.ensureFile(), so read-only commands likesnapai config --show(or any generation using env-var keys) created an empty~/.snapai/config.jsonas a side effect. Reads now checkpathExistsinstead.Preview/generation validation mismatch (
src/commands/icon.ts,src/commands/feature-graphic.ts):--prompt-onlyskipped validation that generation mode performs. Foricon,--model banana-2 -q high --prompt-onlypreviewed fine but failed when actually generating. Forfeature-graphic, the preview skipped all provider-specific checks (-nlimits and--qualityresolution). Previews now run the same validation.Broken npm script (
package.json): removedtest:icon-batch, which points atscripts/test-icon-batch.sh— neither the script nor thescripts/directory exists in the repo.Missing webpack externals (
webpack.config.js):@google/genaiandmimewere missing fromexternals, sopnpm run bundleinlined them while every other runtime dependency stayed external.Cleanup
rawPrompt ? prompt : promptinsrc/services/openai.ts.(GPT-Image-1 only)help text on--background/--output-format/--moderation; these apply to all OpenAI models (with a note thatgpt-image-2rejectstransparent).Verification
main(including feat: Add feature-graphic command for Google Play Store banners #30) into this branch;pnpm run build,pnpm run lint, andpnpm run bundleall pass.icon --model banana -n 2andfg --model banana -n 3 --prompt-only→ single clean error (no double wrapping); runtime errors (e.g. missing API key) still get theFailed to generate ...:prefix.config --showwith no~/.snapai→ no file/directory created;config --openai-api-key ...still persists correctly.--model banana-2 -q high --prompt-onlynow fails the same way generation mode does; normal--prompt-onlypreviews (icon and feature-graphic, incl.--app-name/--style) unchanged.Related open work (not duplicated here)
gpt-image-2responses