Repository navigation
feat(CLI): derive tags from file path slots on push and pull #STRINGS-5103 - #1418
Draft
Sven Dunemann (forelabs) wants to merge 7 commits into
Draft
Sven Dunemann (forelabs) wants to merge 7 commits into
Sven Dunemann (forelabs) wants to merge 7 commits into
Conversation
… pull Auth/Login/Widget.json resolves to the tag auth_login_widget. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
… in tags Tags derived from a path now only drop the extension and replace / with _ (Auth/Login/Widget.json -> Auth_Login_Widget). A pull target file such as ./<file_path>.json maps each tag back to a path (Auth_Login_Widget -> Auth/Login/Widget.json). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
Auth/Login/Widget_Item.json -> Auth__Login__Widget_Item, so single underscores in file names survive the round trip on pull. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
The wildcard is expanded via the tags API (system tags excluded, branch aware, paginated) and needs a <tag> or <file_path> placeholder in the target file. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
On push, the part of the path matched by <locale_name>/<locale_code> becomes LOCALE_NAME/LOCALE_CODE in the tag, so all locales of a file share one tag. On pull, ./<file_path>.ext writes each tag once per locale, substituting the tokens; tags without a locale part are skipped unless locale_id is set. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
Contributor
API changelog (oasdiff)Doc-only edits (descriptions, examples) do not appear here. |
A file pattern may contain named slots, e.g.
./Modules/{module}/Strings/<locale_name>.lproj/{name}.strings. On push the slot
values are joined with __ into one tag (Auth/Passkey + Passkey ->
Auth__Passkey__Passkey); on pull the tag is split again and filled into the
same pattern. The locale uses the normal <locale_name>/<locale_code>
placeholders, so tags carry no locale. A whole-segment slot spans one or more
folders (at most one per pattern); tags entries containing * are expanded via
the tags API and filtered by the slot count.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNNgcv
This branch has not been deployed
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.
Ticket: https://phrase.atlassian.net/browse/STRINGS-5103
What
CLI (
clients/cli/cmd/internal/): file patterns can contain named slots ({name}). On push the slot values of a file become its tag; on pull the tag is turned back into the file path. One.phrase.ymlentry covers a whole tree of nested files.__into a tag and added to the upload tags.Modules/Auth/Passkey/Resources/Strings/en.lproj/Passkey.stringsgetsAuth__Passkey__Passkey. The tag has no locale and no static path parts, so all locales of a file share one tag.<locale_name>/<locale_code>placeholders. The tag is also the download filter.{module}) spans one or more folders (at most one per pattern); any other slot ({name}in{name}.strings) stays within one segment. Slots must be unique, must not be adjacent, and cannot be combined with<tag>or**.tagswith*(pull): entries containing*are expanded through the tags API (system tags excluded, branch aware,per_page=100with pagination)."*"is all tags,"Auth__*"only tags starting withAuth__. Needs a<tag>or{slot}placeholder infile. With slots, tags that do not fit the slot count are left out, so several entries with different path shapes can coexist.__cannot be turned into a tag and fails the push for that file with a clear error.Existing configs without slots /
*in tags are unchanged.Why a separate matcher
placeholders.Resolverejects**, andfillFromPathsplits patterns at a single**for push; neither can carry several slots. Slot patterns therefore use their own matcher (MatchSlots); patterns without slots still go through the unchanged code.ToGlobbingPatternonly gained slot ->*/**.Tests
go vetandgo test ./cmd/internal/...pass (run withGOFLAGS=-mod=mod; the sandboxgo.sumlacksphrase-go,go.mod/go.sumunchanged). Covered: slot/tag round trips for several path shapes (nested module folders,locales/{path}/<locale_name>.lang/data.jsonwith different depths,<locale_code>folders), tags that do not fit,__in values, slot validation, globbing, push file discovery on a temp tree, pull path building per locale, wildcard expansion over 4 pages (305 tags), glob filtering and slot-count filtering.Not verified / follow-ups
Link: rel=nextheader, like the existing locale lookup.go build ./cmdfails on this branch and onmainin the sandbox (UploadsApiCmdundefined, generated code not present); onlycmd/internal/...could be built and tested.__<->/mapping is lossy for folder or file names that contain__(push errors for those).tags: "*"pulls every fitting tag into each entry; use a glob such astags: "Auth__*"per entry.tagsglobs will follow separately (location pending).https://claude.ai/code/session_01Tw7YUuASvfys3UNgAGNgcv
Generated by Claude Code