Skip to content

feat: add publish() to PromptClient - #34

Open
techkayacodes wants to merge 3 commits into
priompt:mainfrom
techkayacodes:feat/publish-prompt
Open

techkayacodes wants to merge 3 commits into
priompt:mainfrom
techkayacodes:feat/publish-prompt

Conversation

@techkayacodes

Copy link
Copy Markdown

Issue

Fixes #23

What changed

  • Added PromptClient.publish(uri, template, slots=None, message="", branch="") in priompt_sdk/client.py, wired to PromptServiceStub.PublishPrompt with metadata=self._md and returning PublishPromptResponse.
  • Added _derive_slots(template) to extract ASCII {slot} names in first-seen, deduplicated order when slots is None while skipping escaped {{ / }} literal braces (matching validate.Slots in priompt/proto). Explicit slots (including slots=[]) are forwarded as-is.
  • Invalidated cached get(uri) and matching list(prefix) entries (uri.startswith(prefix)) only when branch in ("", "main"), keeping the cache warm for non-main branch publishes.
  • Extended FakeStub and added 11 unit tests in tests/test_client.py covering slot derivation, explicit slots, request/metadata forwarding, and cache invalidation across "", "main", and non-main branches.
  • Documented publish() in README.md.

How I tested it

  • Installed editable with pytest in a Python 3.13.18 .venv (uv pip install -e . pytest) and ran pytest -v tests/test_client.py: 40 passed in 0.46s.

Checklist

  • Assigned to #23 and PR links Fixes #23
  • Unit tests added and passing
  • README.md updated
  • AI assistance disclosure: Used an AI coding assistant to research the codebase, draft the implementation and tests, and verify edge cases; all changes were reviewed before submission.

This branch has not been deployed

No deployments
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.

Add publish() to PromptClient

1 participant