feat: smart file naming and default output directory#51
Open
ctate wants to merge 3 commits into
Open
Conversation
Save generations to ~/.ai-cli/generations/ by default instead of cluttering the current working directory. Filenames are now derived from the prompt with a random hex suffix (e.g. a-sunset-a3f2.png) for parallel-safe, descriptive naming. The -o flag and AI_CLI_OUTPUT_DIR env var continue to override the default.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ode normalization - Fall back to "output" slug when prompt contains only special characters - Add existsSync retry loop to avoid filename collisions (keeps 4 hex chars) - Restore per-job index in multi-job filenames (e.g. a-sunset-abcd-1.png) - Inject index before extension when -o <file> is used with multiple jobs - Normalize unicode via NFD decomposition to preserve accented characters
Replace existsSync check-then-write with atomic writeFileSync wx flag to prevent race conditions between concurrent processes. Add 7 integration tests covering explicit dir/file output, index insertion, collision retry, stdout piping, and string data handling.
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
~/.ai-cli/generations/by default instead of the current working directorya-sunset-a3f2.png) — parallel-safe, no filesystem scanning-oflag andAI_CLI_OUTPUT_DIRenv var continue to override the defaultoutput-<hex>.<ext>