Name a file after what it turned out to be - #27
Merged
Merged
Conversation
The template engine understood two tokens and blanked everything else.
It now understands where the file came from, when it was made, its place
in the batch, the format, the quality, the codec, and how large and how
wide it ended up - and it fills them in over two passes, because the
last three of those are only true once the file exists. A name asking
for {dimensions} keeps the token through the conversion and is settled
afterwards, claiming the new name in the same breath as it gives up the
old one.
A token nobody recognises now survives into the name. Blanking it was
the old rule and it hid typos: `{nmae}` in a filename is something
somebody can see and fix. A token Forge does understand and cannot
answer - a codec on a photograph - still leaves nothing behind.
The field for all this shows what your files will actually be called,
resolved by the same code that names them, and the tokens are a menu
rather than something to memorise.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018H9CZxWumc3ryumgEHd578
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.
The template engine understood two tokens and blanked everything else. It now understands where the file came from, when it was made, its place in the batch, the format, the quality, the codec, and how large and how wide it ended up:
{name}{parent}{date}/{date:yyyy-MM-dd}{counter}/{counter:03}{format}{ext}{quality}{codec}{width}{height}{dimensions}{size}They fill in over two passes, because the last few are only true once the file exists. A name asking for
{dimensions}keeps the token through the conversion and is settled afterwards, claiming the new name in the same breath as it gives up the old one. The existing collision safeguard stays underneath.A token nobody recognises now survives into the name. Blanking it was the old rule and it hid typos:
{nmae}in a filename is something somebody can see and fix. A token Forge does understand and cannot answer — a codec on a photograph — still leaves nothing behind. One existing test asserted the old behaviour and has been rewritten to the new rule, with its sibling case added.The field for all this shows what your files will actually be called, resolved by the same code that names them, and the tokens are a menu rather than something to memorise.
Test plan
swift test— green{counter:03}padding,{date:…}patterns, dynamic tokens left alone before the file exists and answered after, two passes equal one, unknown tokens left literalPhotos_001_240x240_q80.jpeg…_003_🤖 Generated with Claude Code
https://claude.ai/code/session_018H9CZxWumc3ryumgEHd578