Skip to content

Add strings_pull and strings_push tools#47

Draft
Stefan Bruhns (sbruhns) wants to merge 2 commits intomainfrom
add-strings-pull-push-tools-v2
Draft

Add strings_pull and strings_push tools#47
Stefan Bruhns (sbruhns) wants to merge 2 commits intomainfrom
add-strings-pull-push-tools-v2

Conversation

@sbruhns
Copy link
Member

Summary

  • Adds strings_pull tool: downloads locale files based on phrase.yml pull targets, supports <locale_name>/<locale_code> placeholders, tag filtering, and branch downloads (automatically resolves branch project ID via branchShow — the Phrase API requires the branch's own project ID for locale downloads)
  • Adds strings_push tool: uploads locale files from phrase.yml push sources with glob expansion (including **), locale extraction from path patterns, tag tagging, and async upload polling
  • Adds shared phrase_config.ts for config parsing, placeholder substitution, and glob-to-regex conversion
  • Adds BranchesApi to StringsClient (needed for branch project ID resolution in pull)
  • 16 integration tests using Polly VCR cassettes recorded against the real mcp-pull-push-test Phrase project — run in replay mode with no network or token required

Test plan

  • npm test — all tests pass in replay mode
  • Re-record cassettes with POLLY_MODE=record PHRASE_STRINGS_TOKEN=<token> npm test -- src/products/strings/tools/pull.test.ts then ...push.test.ts (run files separately to avoid rate limiting)
  • Verify strings_pull via MCP: point at a real phrase.yml and confirm locale files are written to disk
  • Verify strings_push via MCP: push locale files and confirm uploads appear in Phrase Strings

🤖 Generated with Claude Code

@docstun
Copy link
Member

Stefan Bruhns (@sbruhns) since you introduced replay tests with this change, I suggest adding some documentation how to re-generate those in the README.

throw new Error("Download timed out after polling");
}

export function registerPullTool(server: McpServer, runtime: ProductRuntime<"strings">) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically emulates the CLI pull command? It probably works for really basic configs but there are a lot more options that are not supported and we'd need to fully reimplement the target parsing if it should be compatible with the config

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.

3 participants