Skip to content

WP Origin: expose WordPress as a Git remote for Markdown content#238

Open
adamziel wants to merge 2 commits intotrunkfrom
adamziel/wp-origin-git
Open

WP Origin: expose WordPress as a Git remote for Markdown content#238
adamziel wants to merge 2 commits intotrunkfrom
adamziel/wp-origin-git

Conversation

@adamziel
Copy link
Copy Markdown
Collaborator

WordPress as a Git remote. Clone, pull, and push posts and pages as Markdown files using standard Git tooling — no new infrastructure, no external services.

The plugin exposes a Git Smart HTTP endpoint at /wp-json/git/v1/md.git. Posts and pages are exported as Markdown with YAML front matter containing id, type, slug, status, title, date_gmt, and modified_gmt. HTTP Basic Auth with WordPress application passwords handles authentication.

On push the plugin checks staleness using modified_gmt from the front matter: if WordPress content changed since the last pull, the push is rejected with a clear error. Deleted files move content to trash. All writes create WordPress revisions through normal post update behavior.

This commit also renames the Markdown fenced-block language from block to gutenberg (the old name stays accepted on import), and ships an end-to-end smoke test script (bin/test-wp-origin-git-actions.sh) that boots a WordPress Playground instance, clones the repo, edits and pushes a post, verifies the WordPress content updated, then verifies that a stale push is rejected.

Closes the work tracked in the PRD at plugins/wp-origin/docs/prd.md.

Adds the WP Origin plugin, which makes WordPress posts and pages available as a
Git remote. Users and coding agents can clone, pull, and push Markdown files
using standard Git tooling, with WordPress as the source of truth.

The plugin exposes a Git Smart HTTP endpoint at /wp-json/git/v1/md.git, backed
by HTTP Basic Auth with application passwords. Posts and pages are serialized as
Markdown with YAML front matter. Pushes validate staleness before applying
changes and move deleted files to trash rather than destroying content.

This commit also renames the Markdown fenced-code block language from `block`
to `gutenberg` (the old name is still accepted on import), and adds a real
end-to-end test script that boots a WordPress Playground instance, clones the
repo, edits and pushes a post, and verifies that a stale push is rejected.
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