feat(sdk): sdk push — publish an external-mode SDK to its own repository - #114
Merged
Conversation
…tory The SDK counterpart of provider push, sharing its machinery: the same repo parsing, the same environment-only token that reaches git as configuration rather than argv, the same shallow-clone/sync/prune flow, the same generator-owned force-pushed branch namespace, and the same open-or-find pull request -- openPullRequest now takes its title and body from the caller, which is the whole of the refactor. Provenance swaps records: the kiota lock stands where the manifest stood. A tree without one was not generated by this pipeline and is refused; a tree without a go.mod is an embedded SDK -- whose import path only works inside the provider module -- and is refused by name. The branch digest comes from the lock, so one generation always names one branch, and the commit and pull request name the kiota version and the pinned document's hash. Pruning needed one new idea: the SDK root cannot carry a manifest of its own, because sdk generate -check byte-compares it against fresh kiota output. So each push writes the inventory into the target repository instead -- deterministic by construction, no timestamp, sorted entries -- and the next push prunes against it, leaving the target's own files untouched. Proven end to end against a real kiota-generated external tree: 38 files land, the licence survives, and pushing the same generation twice is a no-op. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Why
The last open item from the kiota plan: external-mode SDKs (
sdk generate -mode external) produce a standalone tree with its owngo.mod, but there was no pipeline verb to publish it.sdk pushis the SDK counterpart ofprovider push.What
Same machinery, shared not copied: repo parsing (
owner/name, https, ssh, enterprise,file://), the environment-only token (TFPFGEN_GITHUB_TOKEN/GITHUB_TOKEN) reaching git asGIT_CONFIG_*rather than argv, shallow-clone → sync → prune → generator-owned force-pushed branch (tfpfgen/sdk-<digest>) → open-or-find PR. The only refactor:openPullRequesttakes title/body from the caller.Provenance swaps records — the kiota lock stands where the manifest stood:
kiota-lock.json→ refused ("run sdk generate first").go.mod→ refused by name: an embedded SDK's import path only works inside the provider module; only-mode externaloutput can live in its own repository.Pruning needed one new idea. The SDK root can't carry a manifest —
sdk generate -checkbyte-compares it against fresh kiota output. So each push writes the inventory (.tfpfgen/manifest.json, deterministic: sorted entries, no timestamp) into the target repository, and the next push prunes against it. The target's own files (licence, workflows) are never touched — the same ownership rule provider push enforces.Verification
provider push's: refusals name their cause (lock, embed, token), first push syncs + prunes the previous generation's orphan + preserves target-owned files + carries the provenance message, second identical push is a no-op (proving manifest determinism), dry run pushes nothing./tags-scoped external SDK (builds standalone), pushed to a local bare repo — 38 files ontfpfgen/sdk-9f86b66f9b0c, LICENSE untouched, correct commit message; merged and re-pushed → clean no-op.sdk pushsection + commands table).This closes the kiota plan's last open item.
🤖 Generated with Claude Code