Skip to content

feat(cli): provider push — publish the generated tree as a branch and pull request - #104

Merged
ShocOne merged 1 commit into
mainfrom
feat/provider-push
Aug 4, 2026
Merged

feat(cli): provider push — publish the generated tree as a branch and pull request#104
ShocOne merged 1 commit into
mainfrom
feat/provider-push

Conversation

@ShocOne

@ShocOne ShocOne commented Aug 4, 2026

Copy link
Copy Markdown
Member

Why

This commit was on refactor/naming-standard but landed after PR #101 was merged, so it never reached main. This PR restores it — a clean cherry-pick of c3ebb25, re-tested against main.

What

tfpfgen provider push -out DIR -repo URL [-branch NAME] [-base NAME] [-dry-run] publishes the generated provider tree to its own repository:

  • refuses a tree with no .tfpfgen/manifest.json — push publishes generated output with stated provenance, not arbitrary trees
  • shallow-clones the target, syncs the tree over it, and prunes exactly the files the target's previous manifest owned that are no longer produced; the target repo's own files (release workflows, licence) are never touched
  • no difference → exit 0, nothing pushed
  • a real difference is committed with provenance (tool version, blueprint sources, change count) on the generator-owned tfpfgen/generate-<digest> branch — same content always names the same branch — force-pushed, and answered with a pull request; an already-open PR is updated, not duplicated; non-GitHub remotes get the branch push and a note
  • token from TFPFGEN_GITHUB_TOKEN (or GITHUB_TOKEN), env-only, passed to git via GIT_CONFIG_* environment so it never appears in the process table — the probe-credential doctrine

Verification

  • Seven unit tests drive the real flow against local bare git repositories (sync, prune, target-file preservation, commit provenance, up-to-date no-op, dry-run) and a stub GitHub API covers both the created and already-open PR paths.
  • docs/cli.md documents the verb; the TestUnit_CLI_DocsMatchTheBinary drift test holds it there.
  • Full cmd test suite passes on this branch against current main.

🤖 Generated with Claude Code

… pull request

tfpfgen provider push -out DIR -repo URL shallow-clones the target
repository, syncs the generated tree over it, and prunes exactly the files
the target's previous manifest owned that are no longer produced -- the
same ownership rule the drift check enforces, so the repository's own
files are never touched. No difference exits 0 and pushes nothing. A real
difference is committed with stated provenance (tool version, blueprint
sources, change count) to the generator-owned tfpfgen/generate-<digest>
branch -- the digest comes from the manifest, so identical content always
names the same branch -- force-pushed, and answered with a pull request
against the default branch; a branch whose pull request is already open is
updated rather than duplicated. Non-GitHub remotes get the branch push and
a note instead of a pull request.

The token comes from TFPFGEN_GITHUB_TOKEN (or GITHUB_TOKEN, which Actions
injects), never from a flag, and reaches git through GIT_CONFIG_*
environment variables so it cannot appear in the process table -- the same
doctrine as the probe credential. Tested end to end against local bare
repositories (sync, prune, no-op, dry-run, branch content and commit
provenance) and against a stub GitHub API for both the created and
already-open pull-request paths. docs/cli.md documents the verb and the
drift test now holds it there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ShocOne
ShocOne merged commit 3f2787c into main Aug 4, 2026
12 of 16 checks passed
@ShocOne
ShocOne deleted the feat/provider-push branch August 4, 2026 12:53
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