Skip to content

Name a file after what it turned out to be - #27

Merged
thousandflowers merged 4 commits into
mainfrom
feat/name-templates
Sep 5, 2026
Merged

thousandflowers merged 4 commits into
mainfrom
feat/name-templates

Conversation

@thousandflowers

Copy link
Copy Markdown
Owner

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
  • 13 tests: every token, {counter:03} padding, {date:…} patterns, dynamic tokens left alone before the file exists and answered after, two passes equal one, unknown tokens left literal
  • Real batch through the CLI: Photos_001_240x240_q80.jpeg_003_
  • Overwrite plus a dynamic template: originals replaced, backups kept, nothing lost

🤖 Generated with Claude Code

https://claude.ai/code/session_018H9CZxWumc3ryumgEHd578

thousandflowers and others added 4 commits September 5, 2026 22:54
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
@thousandflowers
thousandflowers merged commit 97860b9 into main Sep 5, 2026
1 check failed
@thousandflowers
thousandflowers deleted the feat/name-templates branch September 5, 2026 21:39
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.

1 participant