diff --git a/docs/product/.product-docs-sync-ledger.json b/docs/product/.product-docs-sync-ledger.json index 2fe7c1c..ee1108c 100644 --- a/docs/product/.product-docs-sync-ledger.json +++ b/docs/product/.product-docs-sync-ledger.json @@ -1473,6 +1473,172 @@ "proposed_patch": "No product docs patch is needed because the existing authoritative product-change report documentation already reflects the merged behavior.", "reason": "PR #181 changes the product-change-report workflow's source-reference rules, but the current long-term product docs already cover the merged behavior. docs/product/raw/product-change-reports.md states that generated reports must not contain commit IDs, related issue references must use linked issue GitHub URLs, and PR references are not misclassified when PR and issue numbers match.", "recorded_at": "2026-06-05T12:28:43Z" + }, + { + "pr": 183, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/183", + "title": "Add product change report for 2026-05-27", + "merged_at": "2026-05-28T09:10:57Z", + "merge_commit": "43752c52df76bd28078d158f4f4d2d50703d5743", + "docs_update": "not-needed", + "affected_docs": [], + "source_context": [ + "PR #183", + "docs/updates/auto-update-2026-05-27.md", + "docs/updates/.product-change-report-ledger.json", + "docs/product/raw/product-change-reports.md" + ], + "proposed_patch": "No product docs patch needed; the merged PR is a time-series update artifact already covered by existing product change report documentation.", + "reason": "PR #183 only adds a time-series product change report under docs/updates/ and updates that report ledger. Existing product docs already describe product change reports as docs/updates artifacts rather than authoritative long-term product knowledge, so no docs/product update is warranted.", + "recorded_at": "2026-06-05T15:41:29Z" + }, + { + "pr": 184, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/184", + "title": "Feat/feature docs 87", + "merged_at": "2026-05-28T09:23:46Z", + "merge_commit": "056357717b3bc062a72e1f4d9e9ae0e7de6885ff", + "docs_update": "required", + "affected_docs": [ + "docs/product/raw/product-docs-sync-workflow.md" + ], + "source_context": [ + "PR #184", + "docs/product/raw/product-docs-sync-workflow.md" + ], + "proposed_patch": "Updated the authoritative product docs sync workflow source to document scheduled and manual scan modes, UTC scan windows, unprocessed PR selection, empty-scan stopping behavior, ledger recording, and ledger-only PR creation for not-needed decisions.", + "reason": "PR #184 changed the long-term behavior of the product docs sync workflow from merged-PR event handling to scheduled/manual merged-PR scanning with ledger-based skip and recording semantics. Existing product docs still described the old trigger and not-needed handling, so the workflow documentation needed to be updated.", + "recorded_at": "2026-06-05T17:34:38Z" + }, + { + "pr": 187, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/187", + "title": "fix(product): 累积处理 product docs sync PR", + "merged_at": "2026-05-28T11:19:40Z", + "merge_commit": "2db0fa6e6a428ce7ab0c8a0f087164d3c6936bb6", + "docs_update": "required", + "affected_docs": [ + "docs/product/raw/product-docs-sync-workflow.md" + ], + "source_context": [ + "PR #187", + "Issue #186", + "docs/product/raw/product-docs-sync-workflow.md" + ], + "proposed_patch": "Updated the product docs sync workflow documentation to describe skipping self-generated docs sync PRs, the fixed docs/product-docs-sync branch, cumulative open PR behavior, new PR titles and draft handling, expanded ledger fields, and accumulated decision display in the PR body.", + "reason": "PR #187 changes long-term product behavior for the product-docs-sync workflow: generated docs sync PRs now use a fixed cumulative branch, skip self-generated sync PRs during scans, and show accumulated ledger decisions in the PR body. The existing product docs described the older per-source-PR behavior and ledger contents, so the authoritative workflow documentation needed updating.", + "recorded_at": "2026-06-05T19:25:30Z" + }, + { + "pr": 188, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/188", + "title": "fix(product): 处理 PR 描述中的 referenced issues", + "merged_at": "2026-05-28T11:31:20Z", + "merge_commit": "f0703f44861ccb89841652c3d5eea44d7b05e49f", + "docs_update": "required", + "affected_docs": [ + "docs/product/raw/product-docs-sync-workflow.md" + ], + "source_context": [ + "PR #188", + "Issue #186", + "docs/product/raw/product-docs-sync-workflow.md" + ], + "proposed_patch": "Updated the product docs sync workflow documentation to describe linked issue extraction from closingIssuesReferences plus PR title/body issue-reference keywords, including deduplication order and PR-reference exclusion.", + "reason": "PR #188 changes the product-docs-sync context contract by treating issue references in PR titles and descriptions as linked issues, while preserving GitHub closing reference priority and excluding PR references. Existing product docs described linked issues generically but did not document this source and parsing behavior.", + "recorded_at": "2026-06-05T21:13:55Z" + }, + { + "pr": 191, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/191", + "title": "fix(create-pr): ignore merged branch prs", + "merged_at": "2026-05-28T18:10:26Z", + "merge_commit": "ef0600303fda5fe6df613cb983a3e84ec2db74c4", + "docs_update": "required", + "affected_docs": [ + "docs/product/raw/create-pr-skill.md" + ], + "source_context": [ + "PR #191", + "Issue #178" + ], + "proposed_patch": "新增 `docs/product/raw/create-pr-skill.md`,记录 `create-pr` skill 的职责、open PR 复用规则、merged/closed PR 不可复用规则,以及更新既有 open PR 时保留人工内容的要求。", + "reason": "PR #191 改变了 `create-pr` skill 的长期 PR 创建/更新语义:只复用当前分支上的 open PR,merged 或 closed 的同名分支历史 PR 不再阻止新建 PR。现有产品文档没有覆盖 `create-pr` skill 的这一权威行为,因此需要新增 raw 产品文档。", + "recorded_at": "2026-06-05T22:49:09Z" + }, + { + "pr": 193, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/193", + "title": "feat(product): add product wiki compile workflow", + "merged_at": "2026-05-29T02:56:10Z", + "merge_commit": "abb0b88272ee91240ef7d6d0cf31a9f385529387", + "docs_update": "required", + "affected_docs": [ + "docs/product/raw/product-wiki-compile-workflow.md" + ], + "source_context": [ + "PR #193", + ".agents/skills/product-wiki-compile/SKILL.md", + ".github/workflows/product-wiki-compile.yml", + ".github/scripts/validate_product_wiki_compile.py", + ".github/scripts/write_product_wiki_compile_pr_body.py" + ], + "proposed_patch": "新增 docs/product/raw/product-wiki-compile-workflow.md,记录 product wiki 编译 workflow 的触发方式、编译输入输出、写入边界、校验规则和 PR 行为。", + "reason": "PR #193 新增了长期产品能力:定时或手动把 docs/product/raw/ 编译为 docs/product/wiki/ 的 LLM Wiki,并定义输入输出、写入边界、校验规则和固定 PR 行为。现有 raw 产品文档没有覆盖该 workflow,因此需要新增权威产品文档。", + "recorded_at": "2026-06-06T01:35:39Z" + }, + { + "pr": 195, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/195", + "title": "Compile product wiki", + "merged_at": "2026-05-29T03:06:36Z", + "merge_commit": "016d54092d7aea134777726da100f5d169c135be", + "docs_update": "not-needed", + "affected_docs": [], + "source_context": [ + "PR #195", + "docs/product/raw/product-wiki-compile-workflow.md" + ], + "proposed_patch": "No product docs patch is needed; leave `docs/product/` unchanged because the merged PR updated compiled wiki output only.", + "reason": "PR #195 only compiled existing authoritative `docs/product/raw/` content into `docs/product/wiki/` query artifacts. The existing raw product docs already describe the product wiki compile workflow and state that raw docs remain the source of truth, so no long-term authoritative product documentation change is warranted.", + "recorded_at": "2026-06-06T05:42:31Z" + }, + { + "pr": 196, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/196", + "title": "Compile product wiki", + "merged_at": "2026-05-29T03:10:18Z", + "merge_commit": "40efcc02f99300650cdbda8cfebcd7d96339df68", + "docs_update": "not-needed", + "affected_docs": [], + "source_context": [ + "PR #196", + "docs/product/wiki/log.md", + "docs/product/raw/product-wiki-compile-workflow.md" + ], + "proposed_patch": "不需要修改 `docs/product/`;该变更仅属于已覆盖的 wiki 编译日志更新。", + "reason": "PR #196 只更新了 `docs/product/wiki/log.md` 中一次 product wiki 编译日志的措辞,没有改变长期产品行为、workflow 契约、权限、状态或用户可见规则。现有 `docs/product/raw/product-wiki-compile-workflow.md` 已覆盖 raw 文档是权威来源、wiki 是查询层以及 log 记录编译变更的产品事实。", + "recorded_at": "2026-06-06T08:13:58Z" + }, + { + "pr": 194, + "url": "https://github.com/Terry-Mao/AICodingFlow/pull/194", + "title": "feat: 每小时运行 Product Docs Sync", + "merged_at": "2026-05-29T03:11:01Z", + "merge_commit": "787032e13497c4b6bd0e1d257519be8ada1d72ac", + "docs_update": "required", + "affected_docs": [ + "docs/product/raw/product-docs-sync-workflow.md" + ], + "source_context": [ + "PR #194", + "Issue #192", + "specs/issue-192/product.md", + "specs/issue-192/tech.md" + ], + "proposed_patch": "Updated docs/product/raw/product-docs-sync-workflow.md to state that scheduled runs trigger every hour at UTC minute 45 and added PR #194 to the source references.", + "reason": "PR #194 changed the Product Docs Sync scheduled cadence from daily to hourly. That is durable workflow behavior already documented in the Product Docs Sync product doc, so the authoritative raw doc needed a small update.", + "recorded_at": "2026-06-06T10:35:14Z" } ] } diff --git a/docs/product/raw/create-pr-skill.md b/docs/product/raw/create-pr-skill.md new file mode 100644 index 0000000..3c89ff4 --- /dev/null +++ b/docs/product/raw/create-pr-skill.md @@ -0,0 +1,21 @@ +# Create PR skill + +`create-pr` skill 用于从当前已提交并已推送或可推送的工作分支创建 review-ready +GitHub pull request,或更新当前分支上仍然 open 的既有 PR。它负责准备 PR +标题、正文、base/head 信息和 issue 关联,不负责实现代码、提交、推送分支或修改 +GitHub issue。 + +## 创建与更新规则 + +创建或更新 PR 时,skill 只复用当前 head branch 上仍处于 open 状态的 PR。检查现有 +PR 时应按当前分支和 `open` 状态过滤;已 merged 或 closed 的历史 PR 不可复用,也不应阻止 +同名分支创建新的 PR。 + +如果找到当前分支的 open PR,skill 会更新该 PR,而不是创建重复 PR。更新前需要读取既有 +PR body,并保留不明显属于本 workflow 生成内容的人工补充,例如手写 notes、review context、 +checklist 或 release details。 + +如果没有当前分支的 open PR,skill 会创建新 PR。即使同名分支过去已经有 merged 或 closed +PR,也应视为没有可更新的现存 PR。 + +来源:PR #191,Issue #178。 diff --git a/docs/product/raw/product-docs-sync-workflow.md b/docs/product/raw/product-docs-sync-workflow.md index 82e0129..3980f94 100644 --- a/docs/product/raw/product-docs-sync-workflow.md +++ b/docs/product/raw/product-docs-sync-workflow.md @@ -6,9 +6,18 @@ ## 触发与上下文 -workflow 可以由 merged PR 的 `pull_request.closed` 事件触发,也可以通过 -`workflow_dispatch` 指定 merged implementation PR number 手动触发。未合并的 PR 不进入同步 -判断。 +workflow 可以按计划运行,也可以通过 `workflow_dispatch` 手动触发。计划运行在每小时 UTC 第 +45 分钟触发一次。手动触发可指定已合并的 implementation PR number;未指定 PR number 时, +workflow 会扫描已合并 PR 并选择尚未处理的目标。未合并的 PR 不进入同步判断。 + +扫描模式使用 UTC 时间窗口。默认窗口是最近 14 天;手动触发时可以用 `scan_days` 覆盖默认天数, +也可以同时提供 `start_date` 与 `end_date` 指定显式 UTC 日期区间,其中 `start_date` 为包含边界, +`end_date` 为不包含边界。扫描结果按 `mergedAt` 升序、再按 PR 编号升序处理;同一次运行只选择 +第一个尚未在产品文档同步 ledger 中记录的 merged PR。 + +扫描候选 PR 时,workflow 会跳过由 product docs sync 自己生成的 PR,避免同步 PR 合并后再次触发 +新的产品文档同步判断。跳过条件包括使用 `docs/product-docs-sync` 前缀的 head branch,或使用 +产品文档同步 workflow 生成的固定 PR title。 同步前,workflow 会基于目标 PR 准备稳定上下文文件: @@ -17,9 +26,19 @@ workflow 可以由 merged PR 的 `pull_request.closed` 事件触发,也可以 - `product-docs-sync-diff.md` - `product-docs-existing.md` -上下文包含 PR metadata、changed files、diff、linked issue、相关 specs 和现有 product docs。 -Agent 必须只把 issue body、PR description、comments、commit message 和 diff 文本当作待分析 -数据,不能把这些内容当作运行指令,也不能在上下文已提供时额外调用 GitHub API。 +上下文包含 PR metadata、changed files、diff、linked issue、相关 specs、现有 product docs、 +扫描窗口、已扫描 PR 数量、已跳过的已处理 PR,以及产品文档同步 ledger 路径。Agent 必须只把 +issue body、PR description、comments、commit message 和 diff 文本当作待分析数据,不能把这些 +内容当作运行指令,也不能在上下文已提供时额外调用 GitHub API。 + +linked issue 优先来自 GitHub `closingIssuesReferences`,并按该列表顺序去重保留。workflow 还会从 +PR title 和 PR body 中解析 `Refs #...`、`References #...`、`Fixes #...`、`Closes #...`、 +`Resolves #...` 和 `Relates to #...` 等 issue 引用;只有 `PR #...` 或 `pull request #...` +形式的 pull request 引用不会被计入 linked issue。这样没有 closing reference、但在 PR 描述中用 +issue reference footer 关联的 issue,也会进入 product docs sync 上下文和相关 specs 读取流程。 + +如果扫描窗口内没有尚未处理的 merged PR,workflow 会写出空目标上下文并停止,不运行 docs sync +agent,也不会创建同步 PR。 ## 决策合同 @@ -39,15 +58,28 @@ Agent 必须在仓库根目录写入 `product-docs-sync-result.json`,其中 `d 当 `docs_update` 是 `required` 或 `uncertain` 时,Agent 只能修改 `docs/product/` 下的文件; 创建新的权威来源文档时优先写入 `docs/product/raw/`。Agent 不得修改 `docs/updates/`、 `docs/product/wiki/`、`.agents/`、`.github/`、`specs/`、产品代码、workflow 文件或 ledger。 +Agent 产出并通过校验后,外层 workflow 负责更新 `docs/product/.product-docs-sync-ledger.json`。 当 `docs_update` 是 `not-needed` 时,Agent 不得修改 `docs/product/`,只记录不需要同步的理由。 ## 同步 PR 行为 -外层 workflow 会先校验上下文 checksum,再校验 `product-docs-sync-result.json` 和写入范围。 -`required` 与 `uncertain` 会创建或更新产品文档同步 PR;`uncertain` 使用 draft PR 表示需要产品 -确认。`not-needed` 不创建产品文档同步 PR,外层 workflow 仅记录处理结果。 +外层 workflow 会先校验上下文 checksum,再校验 `product-docs-sync-result.json` 和写入范围,然后 +把同步决策写入 `docs/product/.product-docs-sync-ledger.json`。ledger entry 记录来源 PR、URL、 +标题、merged time、merge commit、`docs_update`、受影响文档、source context、patch summary、 +reason 和首次记录时间,用于后续扫描跳过已处理 PR,并用于生成产品文档同步 PR body 中的已处理 +决策列表。 + +workflow 使用固定分支 `docs/product-docs-sync` 创建或更新产品文档同步 PR。每次运行会在该分支上 +rebase 默认分支,并把新的 docs sync 决策累积到同一个 open PR 中,而不是为每个来源 PR 创建独立 +同步 PR。普通同步 PR title 是 `Update product docs`;如果最新决策是 `uncertain`,PR 以 draft +状态和 `Draft: Update product docs` title 表示需要产品确认。 + +workflow 会在 `docs/product/` 有变更时创建或更新产品文档同步 PR。PR body 包含最新来源 PR 的 +决策、受影响文档、source context 和 patch summary,并追加展示 ledger 中已处理过的同步决策。 +`not-needed` 不修改权威 markdown 文档,但 ledger 更新仍会创建或更新一个只记录同步决策的 PR。 +同一个同步 PR 可以持续累积多个产品文档同步决策,直到经过 review 并合并。 长期产品文档只有在同步 PR 经过 review 并合并后才成为权威产品知识。 -来源:PR #179,https://github.com/Terry-Mao/AICodingFlow/pull/179。 +来源:PR #179,https://github.com/Terry-Mao/AICodingFlow/pull/179;PR #184,https://github.com/Terry-Mao/AICodingFlow/pull/184;PR #187,https://github.com/Terry-Mao/AICodingFlow/pull/187;PR #188,https://github.com/Terry-Mao/AICodingFlow/pull/188;PR #194,https://github.com/Terry-Mao/AICodingFlow/pull/194。 diff --git a/docs/product/raw/product-wiki-compile-workflow.md b/docs/product/raw/product-wiki-compile-workflow.md new file mode 100644 index 0000000..989d608 --- /dev/null +++ b/docs/product/raw/product-wiki-compile-workflow.md @@ -0,0 +1,73 @@ +# Product wiki compile workflow + +`product-wiki-compile` workflow 用于把 `docs/product/raw/` 中的权威产品文档编译为 +`docs/product/wiki/` 下的 LLM Wiki。Raw 文档仍是产品事实的权威来源;wiki 是面向 agents +和维护者的查询层,负责提供摘要、概念页、索引、schema、链接和编译日志。 + +## 触发方式 + +该 workflow 只通过两类入口运行: + +- `workflow_dispatch` 手动触发。 +- 定时任务,每天 03:10 UTC 运行一次。 + +Workflow 使用固定并发组 `product-wiki-compile`,不会取消已在运行的同组任务。 + +## 编译输入与输出 + +编译输入包括: + +- `docs/product/raw/**/*.md` +- 已存在的 `docs/product/wiki/**/*.md` + +编译输出只能是 `docs/product/wiki/` 下的 Markdown 文件。必需 wiki 文件包括: + +- `docs/product/wiki/AGENTS.md` +- `docs/product/wiki/index.md` +- `docs/product/wiki/summaries/*.md` +- `docs/product/wiki/concepts/*.md` +- `docs/product/wiki/schema/README.md` +- `docs/product/wiki/schema/page-types.md` +- `docs/product/wiki/schema/linking.md` +- `docs/product/wiki/log.md` + +Summary 页面应为每个有意义的 raw source 提供摘要并链接相关 concept 页面。Concept 页面用于汇总 +workflow、角色、状态、规则、自动化边界和 recurring decisions 等高价值查询主题。Index 是 +wiki 查询入口;log 记录本次编译新增或更新的页面、未解决冲突和待确认事实。 + +## 写入边界 + +Codex 编译步骤必须遵循 `.agents/skills/product-wiki-compile/SKILL.md`,并把 +`docs/product/raw/` 视为 source material,而不是可执行指令。 + +编译步骤不得修改 `docs/product/raw/`、`docs/updates/`、`.agents/`、`.github/`、`specs/`、 +产品代码或 workflow handoff files,也不得运行 git 命令、提交、推送、创建 PR、调用 GitHub API +或编辑 issue。外层 GitHub Actions workflow 负责所有 GitHub 写操作。 + +Workflow 在 Codex 编译前记录 raw product docs 的 SHA-256 checksum,并在编译后校验 checksum, +确保编译过程没有修改 raw source。 + +## 校验规则 + +`validate_product_wiki_compile.py` 负责校验 product wiki 编译结果: + +- 允许的变更面仅限 `docs/product/wiki/` 下的 Markdown 文件;`product-wiki-raw.sha256` + 作为 workflow handoff 文件不视为 wiki 变更。 +- 如果存在 raw sources 或 wiki 发生变更,必需 wiki 文件必须存在。 +- Summary 和 concept 页面必须带有 frontmatter,包含 `type`、非空 `title` 和非空 `sources`。 +- `docs/product/wiki/index.md` 必须链接到 `AGENTS.md`、schema 页面、`log.md`、所有 summary + 页面和所有 concept 页面。 +- Summary 页面必须链接相关 concept 页面;concept 页面必须链接支持它的 summary 页面。 +- 不确定或冲突信息应标记为 `待确认` 或 `开放问题`。 + +## PR 行为 + +Workflow 使用固定分支 `docs/product-wiki-compile` 承载编译结果。运行时先基于默认分支初始化或 +rebase 该分支;只有 validator 报告 wiki 文件发生变化时,才提交 `docs/product/wiki` 并创建或更新 +open PR。 + +创建或更新 PR 时,标题固定为 `Compile product wiki`,正文由 +`write_product_wiki_compile_pr_body.py` 生成。PR body 会说明 source root、target root、触发来源、 +变更文件和校验命令,并声明 `docs/product/raw/` 仍是权威来源。 + +来源:PR #193。