Architecture: punt all git concerns to DMC GitSync

未关闭
#61 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
冷清
技术栈
git, php
领域
backend

调研方向

首先审查 MDI 路线图,并在仓库中搜索任何 git shell-outs 或 git primitives。完成的标准是:路线图中不再包含 git auto-commit 工作,所有现有的 git 操作都已确定为需要提取,并且未来的文件监视工作与 DMC GitSync 的职责明确分离。

由索引模型根据 Issue 内容生成。

描述

Statement

Markdown Database Integration should not implement git operations. All git concerns (remotes, pull, push, bind, auth, conflict resolution) belong in the separate Data Machine Code GitSync module, which shipped this layer on 2026-04-20.

This issue exists to formalize that boundary so future contributors don't reach for git primitives inside MDI.

Layering

┌─────────────────────────────────────────────────┐
│ DMC GitSync                                     │
│   bind / pull / push / submit / status / policy │  ← ALL git concerns
│   GitHub Contents + Git Data APIs               │
│   (no shell, no git binary, no .git/ directory) │
└─────────────────────────────────────────────────┘
                      ▲
                      │ points at wp-content/markdown/
                      │
┌─────────────────────────────────────────────────┐
│ Markdown Database Integration                   │
│   WP post ↔ .md file on disk                    │  ← filesystem stops here
│   frontmatter / loader / write engine / index   │
└─────────────────────────────────────────────────┘
                      ▲
                      │
┌─────────────────────────────────────────────────┐
│ WordPress (posts, meta, options)                │
└─────────────────────────────────────────────────┘
  • MDI's job: WordPress post ↔ markdown file on disk. Full stop.
  • GitSync's job: markdown file on disk ↔ upstream git repo.
  • Integration: GitSync writes files; MDI notices (via file-watching, not git).

What stays in MDI

  • File watching / filesystem reactivity — detecting new or changed .md files and rehydrating the post index. This is incremental-sync plumbing, not a git concern.
  • Frontmatter round-trip, slug derivation, ID assignment (see #42).
  • The markdown ↔ block conversion pipeline.

What moves out (or was never MDI's in the first place)

  • git commit / git push / git pull / git status — DMC GitSync.
  • Remote repo configuration and auth — DMC GitSync.
  • Branch / worktree management — DMC GitSync.
  • Conflict resolution semantics — DMC GitSync.
  • PR creation for wiki-content syncs — DMC GitSync's submit ability.

Why this matters

MDI must work identically across environments:

  • Self-hosted with DMC + GitSync installed
  • Studio local dev (symlinked MDI checkouts, no DMC)
  • WP.com / VIP (no drop-ins, no DMC)
  • Minimal installs with only MDI

Coupling MDI to git primitives would produce two code paths — one for "git is available" and one for "git isn't" — which is exactly the class_exists() branching the ecosystem explicitly forbids inside feature flows. Users on managed hosts would get a subtly different MDI than self-hosters.

Keeping git in GitSync makes MDI portable, and makes GitSync swappable (the same markdown/ directory could be synced by any alternative implementation — Meilisearch-based sync, inotify-based local mirror, a Dropbox-style agent, etc.).

Action items

  • Confirm current MDI roadmap does not list "git auto-commit" or similar. If it does, remove it.
  • If any code inside MDI currently shells out to git, extract it. (Spot-check says no, but double-check.)
  • Future "file watching" work (fs_events, inotify, polling) lands in MDI. Future "sync this dir with GitHub" work lands in DMC GitSync.

References

  • DMC GitSync shipped: data-machine-code#38, PR #42, #43
  • DMC GitSync is API-first (GitHub Contents + Git Data APIs) — works on WP.com Business, WP Engine, Pantheon, etc.
主要语言
PHP
星标
8
派生
1
平均合并
22 小时 28 分钟
30 天内合并 PR
15

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Automattic/markdown-database-integration 的其他 Issue

查看 Automattic/markdown-database-integration 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。