diff --git a/README.md b/README.md index b0578f5..d9914de 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ Because local tasks and promoted remote tasks may share `TaskFlowDocs/todo.md`, Before creating or updating a pull request, TaskFlow reads the applicable `.github/pull_request_template.md`, satisfies every required item, records the field mapping and verification in `plan.md`, and blocks PR mutation when a required item is missing or ambiguous. -Run `bash hooks/repository-check [repo-root]` for an opt-in, read-only readiness summary. It reports missing baseline governance and ambiguous branch/remote information as `needs-user-input`, and names any task artifact left uncommitted in the checkout — an uncommitted task directory follows you to whatever branch you check out next, so the next task inherits it. The task-artifact report never changes the exit code; it is not attached to automatic hooks. `bash hooks/release-check [repo-root]` is the same kind of report for a release: it compares the version literals in all four plugin manifests, the newest `CHANGELOG.md` section, and each README's `claude plugin list` sample, and confirms each marketplace `ref` resolves to the commit its `sha` names. It exits `2` on a mismatch and `3` when a manifest is missing; CI runs it on every change. +Run `bash hooks/repository-check [repo-root]` for an opt-in, read-only readiness summary. It reports missing baseline governance and ambiguous branch/remote information as `needs-user-input`, and names any task artifact left uncommitted in the checkout — an uncommitted task directory follows you to whatever branch you check out next, so the next task inherits it. The task-artifact report never changes the exit code; it is not attached to automatic hooks. `bash hooks/release-check [repo-root]` is the same kind of report for a release: it compares the version literals in all four plugin manifests, the newest `CHANGELOG.md` section, and each README's `claude plugin list` sample, and checks that the marketplace entries and the tagged plugin agree. It exits `2` on a mismatch and `3` when a manifest is missing; CI runs it on every change. Any user correction or addition to an approved task is classified before documents change: wording or approach clarifications are work revisions that update only affected records and the Plan change log; changes to an approved goal, requirement, acceptance criterion, scope, or contract create a Task version and return to approval. TaskFlow never continues implementation using an outdated plan. @@ -240,6 +240,30 @@ stateDiagram-v2 TaskFlow ships as a Claude Code / Codex / CodeBuddy / dsh plugin: the `hooks/`, skill, and install wiring are all in one marketplace. No copying files or editing `settings.json` by hand. Trae has no such marketplace, so it is the one host whose install is a documented copy — see [Install with Trae](#install-with-trae). +## Install a specific version + +Starting with `v1.3.1`, one release tag contains both the marketplace catalog and the same plugin version. + +When switching an existing Claude Code or Codex marketplace to a specific version, remove its `taskflow` registration in the corresponding host first with `claude plugin marketplace remove taskflow` or `codex plugin marketplace remove taskflow`. Then add the pinned marketplace and install the plugin again. If an administrator manages the Claude Code source, update that setting instead. + +```bash +claude plugin marketplace add 'https://github.com/hkwuks/TaskFlow.git#v1.3.1' +claude plugin install taskflow@taskflow +codex plugin marketplace add hkwuks/TaskFlow --ref v1.3.1 +codex plugin add taskflow@taskflow +``` + +For CodeBuddy, dsh, or Trae, select the version with a Git checkout: + +```bash +git clone --branch v1.3.1 https://github.com/hkwuks/TaskFlow.git taskflow-v1.3.1 +codebuddy plugin marketplace add ./taskflow-v1.3.1 +codebuddy plugin install taskflow@taskflow +dsh plugin --profile web add ./taskflow-v1.3.1 +``` + +For Trae, use that checkout when copying the files described below. Keep the checkout if its path is used by your hook configuration. + ### Install with Claude Code Add the TaskFlow marketplace, then install the plugin: @@ -333,29 +357,7 @@ CodeBuddy reloads hooks, skills, and agents on `/reload-plugins` without a resta ### Install with dsh -TaskFlow's repository root is a dsh plugin package. dsh has no marketplace and the -package is not on a registry, so the install names the Git repository and pins the -commit — the same commit the release tag names: - -```bash -dsh plugin --profile web add github:hkwuks/TaskFlow#<40-character-sha> -``` - -Take the sha from the release you intend to run. Every release tag names one -commit, and it is the commit the marketplace catalogs pin for the other hosts, so -the value is already published rather than something to work out: - -```bash -git ls-remote https://github.com/hkwuks/TaskFlow.git 'refs/tags/v1.1.15^{}' -# or, in a checkout: git rev-parse v1.1.15^{commit} -``` - -Pinning the full 40 characters is the point, not a formality: `dsh plugin add` -resolves through pnpm, and a bare `github:hkwuks/TaskFlow` would follow `main`, so a -later push would silently change what runs. - -Installed from a local checkout instead, point at the directory — useful while -developing TaskFlow itself, and it tracks the working tree rather than a commit: +TaskFlow's repository root is a dsh plugin package. To install a specific version, use the tagged checkout above. For a development checkout, point at its root: ```bash dsh plugin --profile web add @@ -380,9 +382,7 @@ its output shape from the environment. dsh's SessionStart sources are `startup`, `resume`, `clear`, and `compact`; there is no `fork`, so the dsh matcher omits it. -To move to a newer release, re-add with that release's sha — `dsh plugin --profile web -update` refreshes dependencies, but the pin is what decides which commit the profile -runs, so a new release means a new pin. +To upgrade, check out the new release tag in its own directory and add that checkout to the profile. ### Install with Trae @@ -468,7 +468,7 @@ Every check is a plain script at the repository root — no service, no test fra | --- | --- | | `bash hooks/smoke-test` | Builds temporary `TaskFlowDocs` fixtures and drives the full lifecycle through the hooks. `hooks/smoke-test-windows.ps1` is the Windows equivalent over PowerShell 5.1 and `run-hook.cmd`. | | `bash hooks/repository-check .` | Read-only repository readiness: missing baseline governance and ambiguous branch/remote information, reported as `needs-user-input`. | -| `bash hooks/release-check .` | Every version literal a release has to move agrees, and each marketplace pin resolves to the commit its `sha` names. Exits `2` on a mismatch, `3` on a missing manifest. | +| `bash hooks/release-check .` | Every version literal a release has to move agrees, and both marketplace entries select the tagged plugin. Exits `2` on a mismatch, `3` on a missing manifest. | | `python3 evals/runner.py` | Offline routing evals against immutable sample task trees. The runner is repository tooling, so it is the one thing here that does need Python. | `.github/workflows/hooks.yml` runs four jobs on every push to `main` and every pull request: `smoke` on an Ubuntu / macOS / Windows matrix, `release`, `todo-merge-audit` (no merge in the pushed range dropped a Todo entry), and `evals`. The smoke job deliberately installs no language runtime — the hooks carry none, so a hook that ever grew an interpreter dependency fails there rather than in a user's session. diff --git a/README.zh-CN.md b/README.zh-CN.md index 227bb12..aabc749 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -115,7 +115,7 @@ TaskFlow 从不在 base 工作区里写任务文档:每个任务使用独立 创建或更新 Pull Request 前,TaskFlow 必须读取适用的 `.github/pull_request_template.md`,完成每个必填项,在 `plan.md` 中记录字段映射和验证结果;必填项缺失或有歧义时禁止修改 PR。 -可以运行 `bash hooks/repository-check [repo-root]` 获取可选的只读检查摘要。它会把缺失的基础治理文档和不明确的分支/远端信息标记为 `needs-user-input`,并列出该 checkout 里未提交的任务产物——未提交的任务目录会跟着你进入下一个 `git checkout` 的分支,于是被下一个任务接手。任务产物这一段不影响退出码,也不会挂到自动 hook 上。`bash hooks/release-check [repo-root]` 是同一类面向发布的报告:比对四个插件 manifest、`CHANGELOG.md` 最新的版本段落、两份 README 的 `claude plugin list` 示例中的版本号,并确认 marketplace 的 `ref` 与它声明的 `sha` 指向同一个提交。版本不一致时退出 `2`,manifest 缺失时退出 `3`;CI 在每次改动上都会运行它。 +可以运行 `bash hooks/repository-check [repo-root]` 获取可选的只读检查摘要。它会把缺失的基础治理文档和不明确的分支/远端信息标记为 `needs-user-input`,并列出该 checkout 里未提交的任务产物——未提交的任务目录会跟着你进入下一个 `git checkout` 的分支,于是被下一个任务接手。任务产物这一段不影响退出码,也不会挂到自动 hook 上。`bash hooks/release-check [repo-root]` 是同一类面向发布的报告:比对四个插件 manifest、`CHANGELOG.md` 最新的版本段落、两份 README 的 `claude plugin list` 示例中的版本号,并检查市场目录和标签内的插件版本一致。版本不一致时退出 `2`,manifest 缺失时退出 `3`;CI 在每次改动上都会运行它。 用户对已批准任务提出修正或新增要求时,TaskFlow 必须先分类再修改文档:只改措辞或实现路径的澄清属于工作修订,仅更新受影响记录并在 Plan 变更日志记一行;改动已批准的目标、需求、验收、范围或契约才创建新 Task version 并回到批准门禁。不得带着过期 Plan 继续实施。 @@ -206,6 +206,30 @@ stateDiagram-v2 TaskFlow 以插件形式分发(Claude Code / Codex / CodeBuddy 同一套市场,dsh 为独立插件包,Trae 为 Trae 自有格式的 hooks 文件):`hooks/`、技能与安装配置都在一个仓库里,无需手动复制文件或手改 `settings.json`。 +## 安装指定版本 + +从 `v1.3.1` 起,一个发布标签包含对应版本的市场目录和插件内容。 + +Claude Code 或 Codex 已注册 `taskflow` 市场时,切换到指定版本前,先在对应宿主运行 `claude plugin marketplace remove taskflow` 或 `codex plugin marketplace remove taskflow`,再添加指定版本的市场并重新安装插件。Claude Code 市场来源由管理员管理时,需更新对应设置。 + +```bash +claude plugin marketplace add 'https://github.com/hkwuks/TaskFlow.git#v1.3.1' +claude plugin install taskflow@taskflow +codex plugin marketplace add hkwuks/TaskFlow --ref v1.3.1 +codex plugin add taskflow@taskflow +``` + +CodeBuddy、dsh 和 Trae 可以通过检出指定标签选择版本: + +```bash +git clone --branch v1.3.1 https://github.com/hkwuks/TaskFlow.git taskflow-v1.3.1 +codebuddy plugin marketplace add ./taskflow-v1.3.1 +codebuddy plugin install taskflow@taskflow +dsh plugin --profile web add ./taskflow-v1.3.1 +``` + +Trae 从这个检出目录复制下文列出的文件。如果 hook 配置引用了该目录,请保留它。 + ### 用 Claude Code 安装 先添加 TaskFlow 市场,再安装插件: @@ -298,26 +322,7 @@ CodeBuddy 通过 `/reload-plugins` 重新加载 hooks、技能和代理,无需 ### 用 dsh 安装 -TaskFlow 的仓库根目录本身就是一个 dsh 插件包。dsh 没有插件市场,这个包也不在任何 -registry 上,所以安装命令直接指向 Git 仓库并钉住 commit——就是发布 tag 所指向的那个: - -```bash -dsh plugin --profile web add github:hkwuks/TaskFlow#<40 位 sha> -``` - -sha 从你要运行的版本取。每个发布 tag 指向一个 commit,而它也正是其它宿主的 marketplace -catalog 所钉的那个,所以这是一个已经公开的值,不需要自己推算: - -```bash -git ls-remote https://github.com/hkwuks/TaskFlow.git 'refs/tags/v1.1.15^{}' -# 或在本地检出中: git rev-parse v1.1.15^{commit} -``` - -钉满 40 位不是形式:`dsh plugin add` 经由 pnpm 解析,写成 `github:hkwuks/TaskFlow` -会跟随 `main`,于是之后任何一次推送都会悄悄改变实际运行的代码。 - -从本地检出目录安装则直接指向该目录,适合在开发 TaskFlow 自身时使用——它跟随工作树 -而不是某个 commit: +TaskFlow 仓库的根目录就是 dsh 插件包。固定版本时使用上文的标签检出。开发时直接指向本地检出目录。 ```bash dsh plugin --profile web add <仓库根目录> @@ -339,8 +344,7 @@ dsh 通过 `hooks/hooks-dsh.json` 和 dsh 自带的 Claude Code hook 桥接, dsh 的 SessionStart 来源是 `startup`、`resume`、`clear`、`compact`,没有 `fork`, 因此 dsh 的 matcher 不含它。 -升级到新版本时,用新版本的 sha 重新 add——`dsh plugin --profile web update` 会刷新依赖, -但真正决定 profile 运行哪个 commit 的是那个 pin,所以换版本意味着换 pin。 +升级时,在新目录检出目标标签,再把该目录添加到 profile。 ### 用 Trae 安装 @@ -417,7 +421,7 @@ dsh plugin --profile web add <仓库根目录> | --- | --- | | `bash hooks/smoke-test` | 构造临时 `TaskFlowDocs` 夹具,通过 hook 跑完整生命周期。`hooks/smoke-test-windows.ps1` 是 Windows 上的等价实现(PowerShell 5.1 + `run-hook.cmd`)。 | | `bash hooks/repository-check .` | 只读的仓库就绪度检查:缺失的基础治理文档、不明确的分支/远端信息,标记为 `needs-user-input`。 | -| `bash hooks/release-check .` | 一次发布要改动的所有版本字面量是否一致,以及每个 marketplace pin 是否解析到它 `sha` 声明的那个提交。不一致退出 `2`,manifest 缺失退出 `3`。 | +| `bash hooks/release-check .` | 一次发布要改动的所有版本字面量是否一致,以及两份市场目录是否选择同版标签的插件。不一致退出 `2`,manifest 缺失退出 `3`。 | | `python3 evals/runner.py` | 针对不可变示例任务树的离线路由评测。runner 属于仓库工具链,是这里唯一需要 Python 的东西。 | `.github/workflows/hooks.yml` 在每次推送 `main` 和每个 Pull Request 上跑四个作业:`smoke`(Ubuntu / macOS / Windows 矩阵)、`release`、`todo-merge-audit`(推送范围内没有 merge 丢掉 Todo 条目)、`evals`。smoke 作业刻意不安装任何语言运行时——hook 本身不依赖运行时,所以一旦某个 hook 长出解释器依赖,会在这里失败,而不是等到用户会话里才暴露。 diff --git a/RELEASE.md b/RELEASE.md index ab68882..889acb1 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,230 +1,57 @@ # Release process -This is the manual, auditable release checklist for TaskFlow. Do not create a tag, GitHub Release, or package publication until the release owner approves the release commit. +Run this process directly on the base checkout. A release ships previously merged work and does not create a TaskFlow task or a `todo.md` item. The release owner approves the exact release commit before an annotated tag is created, a ref is pushed, or a GitHub Release is published. -**This procedure is executed directly, on the base checkout.** A release does not create a TaskFlow task or a `todo.md` item, does not take a branch or a working tree, and does not write a PRD, Spec, or Plan — the repository's task workflow plans work that does not exist yet, and a release ships what is already merged. A release that also changes the plugin is development work; do that part under TaskFlow first, then release what merged. The record of a release is its `CHANGELOG.md` section and its GitHub Release body, both written below. +## Prepare the release -The approval gate comes with the procedure instead of with a Plan's `## Approval` block: the release owner approves the release commit before step 5 pushes, and that approval is what the release notes and the catalog pin stand on. Never push a tag or open a GitHub Release that the owner has not approved. - -## Release scope - -TaskFlow ships as a repository plugin for Claude Code, Codex CLI, CodeBuddy, and dsh, and as a copy-in hooks file for Trae. Keep these artifacts aligned: - -- `.codex-plugin/plugin.json` — Codex manifest and development cachebuster; -- `.claude-plugin/plugin.json` — Claude Code manifest version; -- `.codebuddy-plugin/plugin.json` — CodeBuddy manifest and development cachebuster; -- `package.json` — the dsh bundle manifest (its `dsh.bundle.patch` is what makes the repository root installable as a dsh plugin); -- `.claude-plugin/marketplace.json` and `.codebuddy-plugin/marketplace.json` — catalog entries pinned to the stable release tag and full commit SHA; -- `skills/taskflow/` and `hooks/` — plugin contents (Trae carries no version literal: it copies `hooks/hooks-trae.json` and the skill directory, so there is nothing to bump and nothing to pin); -- README, governance documents, and release notes. - -Six of those files carry a version literal, eight in all: the four manifests, and -the two `plugin list` samples in each README. Seven of the eight are transcription -of one approved version string, so `hooks/release-version` writes them in a single -call: +1. Verify the target repository and branch, synchronize the base by fast-forward, and start with a clean checkout. Confirm the changes are merged and the Hooks workflow passed on that base. Read the release routes in `TaskFlowDocs/repository-docs/index.md`, including the applicable contribution, style, and roadmap rules. +2. Write the version and date, user-visible changes, migration or installation impact, limitations, and verified results in the new `CHANGELOG.md` section. Link the green base CI run and state that the release diff consists of metadata. +3. Run `bash hooks/release-version X.Y.Z`. It derives the manifest versions, README samples, and both marketplace refs from that single version. It leaves the changelog to the author and does not tag or push. +4. Run the local release checks below. Commit the changelog, manifest and README changes, and both catalog updates together on the base. Send the exact commit and verification results to the release owner for approval. ```bash -bash hooks/release-version X.Y.Z +bash hooks/repository-check . +bash hooks/release-check --prepare . +python3 /scripts/quick_validate.py skills/taskflow +git diff --check ``` -It checks before it writes, so a refusal leaves every file untouched, and it -refuses until the `CHANGELOG.md` section exists — see the ordering rule under -Release notes. It never creates a tag, pushes, or publishes anything; the two -manual steps below stay manual. +The release check compares the four manifests, newest changelog version, every README version sample, and both marketplace refs. The preparation mode requires a new tag name and ref-only catalogs. The default mode verifies the actual tagged catalogs and manifests. It also validates existing SHA pins on historical releases that already use them. A mismatch exits `2`. Missing manifest files exit `3`. -## Before release +The local checks inspect release metadata and the Skill. The three-platform Hooks matrix on the merged base covers the implementation. Re-run a local smoke test when the release actually changes a surface it exercises. Record skipped and unavailable checks explicitly. Real host installation and runtime coverage are recorded separately from catalog validation. -Open the release from the base checkout and confirm: +## Publish the approved commit -- target repository and base branch; -- clean working tree and approved release scope; -- intended changes are merged into the intended base (`main` by default); -- applicable `CONTRIBUTING.md`, `CODE_STYLE.md`, `ROADMAP.md`, and PR template are read; -- the version follows the approved repository decision. +Both marketplace catalogs and the plugin files live in the same release commit. A catalog has one Git selector, `"ref": "vX.Y.Z"`. The tag name is known during preparation, and Git resolves it at install time. The catalog on `main` continues pointing to the latest stable release while development moves forward. -The default path is a direct tag from the verified base commit; a `release/vX.Y.Z` branch and Release PR are optional when release-only documentation needs separate review or the owner requests a release candidate. +Follow `CONTRIBUTING.md` for the bookkeeping that belongs to no development task. The release owner must be able to push the target branch and tag together. -## Validation checklist - -Run and record applicable results. These four stay unconditional: - -```bash -bash hooks/repository-check . -bash hooks/release-check . -python3 /scripts/quick_validate.py skills/taskflow # is wherever that checkout lives -git diff --check -``` - -`hooks/release-check` and `hooks/repository-check` inspect the release's own -artifacts — the version literals, the catalog pin, and the record's freshness — -and those differences do not exist until the release is prepared, so no CI job -can see them. `quick_validate.py` and `git diff --check` are simply not run by -any CI job. None of the four is covered by CI, which is why none of them is -skippable. - -The smoke suite is not on that list, because CI does cover it: the `smoke` job -runs it on `ubuntu-latest`, `macos-latest`, and `windows-latest` for every pull -request and every push to `main` (`.github/workflows/hooks.yml`). That is wider -than any single local run and is the verdict this release stands on. Run -`bash hooks/smoke-test` locally only when the release touches a surface the suite -exercises — a release does not: the release commit moves version literals and the -`CHANGELOG.md` section, and the commit after it moves the two marketplace -catalogs. - -The test is the surface, not the revision. "CI already ran this commit" cannot be -the rule: the tag names a commit that does not exist until the release is -prepared, and the tag and pin are pushed together, so at checklist time CI has not -seen it. What does hold is that the release commit's difference from a CI-green -commit — the last one on `main` before the release began — falls outside what the -suite exercises. Record that comparison in the release notes, together with the -CI run being relied on. - -`hooks/release-check` compares the version literals a release has to move — the -three host manifests, the dsh bundle manifest, the newest `CHANGELOG.md` section, -and **every** `plugin list` sample in each README, not just the first one — and -confirms each marketplace `ref` resolves to the commit its `sha` names. It also -fails when the range from the tagged commit to the commit that recorded the pin -contains a change outside the two marketplace catalogs (paths under -`TaskFlowDocs/` are exempt), because such a change would ship under the pin -without being in the release commit the tag names. It exits `2` on a mismatch and -`3` when a manifest is missing. - -The dsh bundle manifest carries no cachebuster. dsh installs the package through -pnpm rather than through a host-side plugin cache, so there is no stale-copy -failure for a suffix to defeat; bump its `version` with the others. - -Do not claim an unavailable check passed. A check that was skipped is recorded as -skipped — with the CI run that covered it and the comparison that justified the -skip — so that "not run" and "ran and passed" never read the same. - -## Release notes - -The release notes are the record: the `CHANGELOG.md` section and the GitHub Release body carry it, and no other document is written for the release. - -Include the version and date, user-visible changes, migration or installation impact, known limitations, verification results, and the release commit (and Release PR when used). Do not include secrets or unverified claims. - -**The `CHANGELOG.md` section is written before the tag.** The tag is the immutable -artifact — it is what the marketplace `sha` pins, and moving it needs explicit -owner authorization — so the commit it names has to be the complete release on its -own. Writing the section afterwards would put the release record in a commit the -tag does not name, leaving the tagged tree describing a release whose notes it -does not carry. `hooks/release-version` enforces the order by refusing to run -until the section exists. - -## Tag, catalog pin, and GitHub Release - -After the release scope is merged to the intended base (or the optional Release PR is merged): - -1. Check out the exact merged base commit and confirm a clean working tree. -2. Verify manifest versions and release notes again — the `CHANGELOG.md` section - must already be in this commit, because the tag names it. -3. Create an annotated tag named `vX.Y.Z` on that commit, whose subject line is - `TaskFlow X.Y.Z` — no `v` in the subject, because the `v` belongs to the tag - name and not to the release. This is the established format: every tag since - `v1.1.0` reads `TaskFlow 1.1.10`, and the eleven `1.1.x` releases are what the - format is taken from, against four `1.0.x` releases that still carried the - `v`. New releases follow the majority and the most recent, and the `v1.0.x` - titles are left alone — a tag is immutable and rewriting one needs the owner - authorization under Rollback. +1. Verify `HEAD` still equals the approved release commit. Confirm remote `main` is the expected base and neither `refs/tags/vX.Y.Z` nor `refs/heads/vX.Y.Z` exists on the target remote. Stop on an existing ref or an inconclusive remote check. +2. Create an annotated tag named `vX.Y.Z` with subject `TaskFlow X.Y.Z`, verify it resolves to the approved commit, and run the release check in its default mode. ```bash git tag -a vX.Y.Z -m "TaskFlow X.Y.Z" + git rev-parse 'refs/tags/vX.Y.Z^{commit}' + bash hooks/release-check . ``` -4. Update both marketplace entries so each Git source uses the release tag as `ref` - and the exact tagged commit as `sha`, then commit that edit locally. It carries - only those four literals — `ref` is the tag name and `sha` is - `git rev-parse ^{commit}` — so there is nothing in it to review. -5. Push the pin commit and the tag together, in one atomic push, after explicit - release-owner approval: +3. Push the branch and tag atomically. Stop if the push is rejected. Use a normal push so an existing version cannot be replaced. ```bash - git push --atomic origin main refs/tags/vX.Y.Z + git push --atomic origin main:refs/heads/main refs/tags/vX.Y.Z:refs/tags/vX.Y.Z ``` - The pin commit must carry nothing else, and the push must carry no other refs. -6. Run `bash hooks/release-check .` again on the pushed `main`, and create the - GitHub Release from the tag with the approved notes. The release title is - `TaskFlow X.Y.Z` — the same string as the tag subject, so the two never have to - be reconciled by a reader — and the body opens with - `TaskFlow X.Y.Z — YYYY-MM-DD` before the summary and the release record below. -7. Record the result in the release notes: the tag, the release URL, the commit, and the two marketplace pins. - -**Catalog correctness is decided by `release-check`, not by a person with three -CLIs.** What a catalog entry can be wrong about without a network is whether its -`ref` names the tag and whether that tag resolves to the `sha` recorded beside -it, and `release-check` answers both — which is why step 6 runs it again after -the push. There is no third thing for a manual pass to find, and there are two -catalogs rather than three: `.claude-plugin/marketplace.json` and -`.codebuddy-plugin/marketplace.json`. Codex installs through the first of those, -and hosts no catalog of its own. - -What a manual pass *could* find is whether a real host installs the release end -to end, and that is a different check with a different owner: it needs the -network, it cannot run before the tag exists, and it cannot run inside the -atomic push that publishes it. It therefore cannot gate anything here — by the -time it could fail, the tag is already immutable and public — so it does not -belong on this list at all. A step that runs after the irreversible act and -whose failure has no defined response is not a check; it is a note that the -check happened to be skipped. If end-to-end installation ever needs to be -verified rather than assumed, that belongs in CI against the published tag, not -in a release checklist that has already finished. - -Steps 3–4 make a release two commits, by construction: the tag cannot be created -before the release commit exists on the base, and the pinned `sha` cannot be -written before the tag exists. Claude Code verifies the pin at install time and -refuses a mismatch as `sha_pin_mismatch`, and it clones by the pinned commit -rather than by the tag, so the pin is what keeps an installation on the reviewed -release if the tag is ever moved. The second commit is the pin, not a mistake. - -Two commits, but not two pushes. The tag has to exist before the pin is -readable, and the pin has to be readable before the tag is useful; pushing them -apart leaves an interval where the catalog names a tag that is either missing -or stale, and a refresh landing in that interval installs the previous release. -`--atomic` makes both refs visible at once, so the interval does not exist. - -This step is a direct push rather than a pull request on purpose. It moves two -things at once: an immutable tag, and the catalog record naming it. The record -is mechanically derived, so there is nothing to review, and its correctness is -enforced rather than reviewed — `git merge-base --is-ancestor` for the tag, and -`bash hooks/release-check .` for the `ref`/`sha` pair. A pull request here would -only reintroduce the interval it is meant to close, for a four-line diff whose -content the tag already determined. The release metadata commit is a different -matter: it carries prose, so it takes the Release PR path above. - -This is the criterion `CONTRIBUTING.md` states for the bookkeeping that belongs to -no task — push the target branch directly when its author can push it, open a -pull request when they cannot. A release is one of those changes, and it assumes -the first answer rather than choosing it: the tag and the pin must become visible -together, and a pull request cannot carry a tag, so an author who cannot push -`main` needs the release owner to push it rather than a different path here. - -If the remote rejects an atomic push, fall back to pushing the tag first and -updating the catalog after, exactly as this document required before the -atomic form existed, and record the resulting interval in the release notes. Do -not work around the rejection by putting other files into the atomic push: that -would make one unreviewable push out of the release metadata and an irreversible -tag. - -The marketplace catalog itself remains on `main` so refreshes can discover the latest stable entry. The plugin source must not point at moving `main`; local-directory marketplace registration remains the development path. - -### Optional Release PR path - -Use `release/vX.Y.Z` when the release needs an isolated documentation review, a release candidate, or an explicit PR approval. Merge that PR before applying the same tag and GitHub Release steps above. - -TaskFlow does not push tags or create GitHub Releases automatically. +4. Verify the live tag and branch resolve to the approved release commit. Publish the GitHub Release from the existing tag with title `TaskFlow X.Y.Z`. Open the English release notes with `TaskFlow X.Y.Z — YYYY-MM-DD` and include the release commit, tag, checks and install impact. +5. Read back the GitHub Release, verify `releases/latest` and the two catalogs at the tag, and verify the resulting main CI run. -## Rollback +The four manifests are `.claude-plugin/plugin.json`, `.codex-plugin/plugin.json`, `.codebuddy-plugin/plugin.json`, and `package.json`. The marketplace files are `.claude-plugin/marketplace.json` and `.codebuddy-plugin/marketplace.json`. Trae uses its hook configuration and the Skill from the selected checkout. -Stop distribution, record the affected tag/commit and impact, and prefer a corrective patch release. Deleting or moving a remote tag requires explicit owner authorization and a documented reason. Never rewrite shared branch history as a rollback. +## Rollback -A wrong catalog record is corrected like any other catalog change — a new -commit with the right `ref`/`sha`, verified by `bash hooks/release-check .` — -and does not touch the tag. Only a wrong *tag* needs the authorization above, -because the tag is the part installations are pinned to. +Prefer a corrective patch release and record the affected version and users. Moving or deleting a published tag requires explicit release-owner approval and a documented reason. Do not rewrite shared branch history. A correction to the default marketplace on `main` does not rewrite the snapshot at a published tag. ## Known limitations -- The generic plugin validator may reject the existing Codex manifest `hooks` field even when Codex installation and TaskFlow smoke tests pass; record the discrepancy rather than deleting the hook declaration. -- `hooks/repository-check` is opt-in and does not mutate Git remotes or enforce release permissions. -- Release automation, package registries, signing, and provenance attestations are not configured by this document. +- A generic plugin validator may reject the existing Codex manifest hook field even when the host and smoke tests accept it. Record the validator result and keep the hook declaration. +- Repository and release checks do not write Git refs or publish GitHub Releases. +- Package registries and signing are outside this release process. diff --git a/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/plan.md b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/plan.md new file mode 100644 index 0000000..fc5fa96 --- /dev/null +++ b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/plan.md @@ -0,0 +1,135 @@ +# Plan — 按标签安装同版本 TaskFlow +> Task version: v1 +> Status: completed + +## Spec Pointers + +- `spec.md` + +## Reference Pointers + +- `RELEASE.md`、`hooks/release-check`、两个已跟踪的市场目录。 +- Claude Code 和 Codex CLI 的官方安装命令说明。 + +## Related Tasks + +- TF-20261201-0314e6。 + +## Skills / Tools Used + +- [PRD] Declared `agent-skills:spec-driven-development` — 核对发行目标和固定版本安装的范围。 +- [Spec] Declared `agent-skills:spec-driven-development` — 定义标签、目录和载荷之间的契约。 +- [Plan] Declared `agent-skills:planning-and-task-breakdown` — 将 Git 规则、可复现验证和安装命令按依赖排列。 +- [Test] Unaided — none applied; considered: testing strategy. + +## Capability Contributions + +- [PRD] `agent-skills:spec-driven-development` | prd.md#Acceptance Criteria | 把选定版本与实际安装版本一致变成可在隔离环境读回的验收。 +- [Spec] `agent-skills:spec-driven-development` | spec.md#Interfaces, Data Flow, and Contracts | 将目录和载荷定位为同一标签快照,并明确由发布检查校验的接口。 +- [Plan] `agent-skills:planning-and-task-breakdown` | plan.md#Step 1 — 验证标签对应的市场目录 | 把 Git 和目录校验放在先行步骤,之后用宿主安装复核可用性。 + +## Preconditions + +- 用户批准 v1。如后续需要真实发布,按 RELEASE.md 单独授权。 + +- 分别记录 Claude Code、Codex、CodeBuddy、dsh 和 Trae 的固定安装路径、支持依据、验证证据与未覆盖项。 + +## Plan Review + +- Verdict: sound +- Coverage: 单标签下的目录和插件、发布检查、唯一性及五宿主安装路径均有对应步骤。 +- Verifiability: 临时 Git 树覆盖正确标签、过旧目录、冗余字段、同名分支和版本不符。分开记录宿主真实安装与静态检查。 +- Layer ownership: 校验器验证提交图和目录数据。发行指南定义推送顺序。各宿主负责安装。 + +## Approval + +- Status: approved +- Approved by: user +- Approved at: 2026-12-02 16:28 +0800 +- Approved version: v1 +- Approved scope: PRD / Spec / Plan +- Approved repository checks: f65def3b4d42e49fb3ea4faba53f72498dfc1edd + +## Repository Rule Checks + +- host-coverage: applies +- host-coverage/claude-code: Step 2 | 隔离用户目录安装公开标签,读回安装版本。 +- host-coverage/codex: Step 2 | 隔离用户目录以 --ref 安装公开标签,读回安装版本。 +- host-coverage/codebuddy: Step 2 | 核对官方市场格式、独立目录与当前可用安装入口。 +- host-coverage/dsh: Step 2 | 验证按版本选取 Git 发布内容及其 dsh bundle 版本。 +- host-coverage/trae: Step 2 | 验证从标签 checkout 选择要复制的 hook 和 Skill 文件。 + +## Steps + +### Step 1 — 验证标签对应的市场目录 + +- Goal: 在发布前能确定公共标签对应正确的两份目录和载荷。 +- Dependencies: 用户批准 v1。 +- Files: hooks/release-version、hooks/release-check 及其 Git 夹具。 +- Implementation checklist: + - [x] 从 X.Y.Z 统一生成两份目录的版本 ref。 + - [x] 验证公共标签与同版清单和目录,拒绝同名分支、过时目录和冗余 SHA。 + - [x] 旧版已发布目录与常规开发检查仍可核对。 +- Acceptance: 正常和拒绝样例可本地复现。 +- Verification: 临时 Git 仓库及既有发布检查。 +- Rollback: 回退指定标签的检查模式与回归。 +- Status: done + +### Step 2 — 接入发布与版本安装说明 + +- Goal: 发布步骤和两个宿主的使用说明都基于公共安装标签。 +- Dependencies: Step 1。 +- Files: RELEASE.md、README.md、README.zh-CN.md。 +- Implementation checklist: + - [x] 记录单一发布提交、标签检查和原子推送。 + - [x] 记录 Claude Code 和 Codex 如何固定市场目录到 vX.Y.Z。 + - [x] 演练正常的本地发布路径。能隔离验证安装时记录实际插件版本。 + - [x] 核对 CodeBuddy 固定版本路径、dsh 和 Trae 从标签取得发布内容的方式。在可用宿主的隔离配置中读回实际版本或内容。 +- Acceptance: 文档命令可复现,正式发布等待独立授权。 +- Verification: 本地演练、双语对照、官方命令说明。 +- Rollback: 回退发行和安装文档。 +- Status: done + +## Checkpoints + +## Verification / Review + +- 2026-12-02 Step 2: PR #163 的候选通过 Ubuntu、macOS 和 Windows。安装验证覆盖 Claude Code、Codex、CodeBuddy 和标签目录的五宿主材料。用户已确认归档。[CI](https://github.com/hkwuks/TaskFlow/actions/runs/46849049721) + +- 2026-12-02:#163 的 macOS smoke 暴露 BSD sed 将文件位的短横线视为文件名。统一让无文件参数的读入走标准输入。模拟拒绝短横线文件参数后,完整发布回归通过。补记已注册市场切换时的前置步骤。 + +- 2026-12-02 Step 2: 三种宿主的隔离试装及 dsh、Trae 的标签路径已核对,等待候选 GitHub CI。 + +- 2026-12-02 Step 1: 隔离测试验证准备模式、现有标签检查、同名分支及过期市场 ref 拒绝。现有正式目录也通过默认校验。 + +- 确认现有 v1.3.0 标签的目录比插件版本落后一代。官方文档确认两宿主均支持指定目录版本。 +- 2026-12-02:隔离配置试装。测试仓库 main 已是 9.8.8,市场目录只写 ref v9.8.7。Claude Code 2.1.311 和 Codex CLI 0.167.2 都从 v9.8.7 安装,缓存清单读回 9.8.7。 +- 2026-12-02:CodeBuddy 2.188.1 从 v9.8.7 的本地 Git checkout 注册市场并安装,缓存清单读回 9.8.7。没有采用未通过测试的远端市场 URL 追加 #版本入口。 +- 2026-12-02:从已发布的 v1.3.0 隔离检出读回 dsh bundle 版本和 Trae 需要复制的 hook 配置及 Skill。此检查覆盖标签内容,宿主运行另计。 +- 2026-12-02:复现 Windows Git Bash 对带斜线的 ref:path 参数转换。先解析精确标签,再只在检查器内部按对象读取市场目录和四份 manifest。 +- PR #163 首轮 Ubuntu 冒烟发现发布文档精简后漏掉两条既有表述。保留发布不建开发任务和按贡献规范处理直接发布的要求,重新跑三平台。 + +- host-coverage/claude-code: verified | reference/host-checks.md +- host-coverage/codex: verified | reference/host-checks.md +- host-coverage/codebuddy: verified | reference/host-checks.md +- host-coverage/dsh: verified | reference/host-checks.md +- host-coverage/trae: verified | reference/host-checks.md + +## Change Log + +- 2026-12-01:按用户确认的双标签方向建立 v1。 +- 2026-12-02:按用户要求移除重复绑定,收敛到一个公开版本标签。 + +## Follow-ups + +## Version History + +- v1 — planning. + + +## Pull request + +- Summary: 让发布标签和市场安装指向同版,用单一 ref 固定。 +- TaskFlow traceability: TF-20261201-0314e6,当前任务代码、文档和回归,目标 hkwuks/TaskFlow 的 main。 +- Verification: 记录定向回归、差异检查、宿主覆盖及 GitHub CI。 +- Review boundaries: 单独交付当前已批准范围,明确实际宿主覆盖边界。 diff --git a/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/prd.md b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/prd.md new file mode 100644 index 0000000..f081264 --- /dev/null +++ b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/prd.md @@ -0,0 +1,57 @@ +# 按标签安装同版本 TaskFlow +> Task version: v1 +> Status: completed + +## Goal + +使 Claude Code 和 Codex 通过任务仓库的公开 vX.Y.Z 标签安装同一版本 TaskFlow。 + +## Task Kind + +- Kind: capability + +## Background / Confirmed Facts + +- 当前发布先在载荷提交创建 vX.Y.Z,再更新市场目录。实际 v1.3.0 标签里的目录仍指向 v1.2.10。 +- Claude Code 和 Codex 读取同一份 Git 市场目录。CodeBuddy 的独立市场目录同步固定到同一载荷。 + +## Requirements + +- 单个公开标签 vX.Y.Z 指向包含正确目录和同版插件的提交。目录只记录这个版本 ref。 +- 由现有 release-version 一次写入两份目录的 ref。发布前验证标签、两份目录和插件版本一致,原子推送 main 与该标签。 +- 双语安装指南给出官方支持的固定目录版本方式。 + +- 逐一核对 Claude Code、Codex、CodeBuddy、dsh 和 Trae 的安装方式。用户只需提供版本标签,必要时由宿主或本地 Git 从标签解析安装目标。 + +## Acceptance Criteria + +- 临时 Git 仓库里的正常发布通过校验。缺标签、同名分支、目录 ref 过旧、附带冗余 SHA 或清单版本不匹配时拒绝。 +- 两份目录由公共标签读取时都指向匹配版本。已存在的发布标签无需改动,正常开发的既有发布检查继续工作。 + +## External Facts + +- Depends on external facts: yes +- Source: https://code.claude.com/docs/en/plugins/install +- What it settled: Claude Code 使用 #ref 固定市场目录。 +- Source: https://code.claude.com/docs/en/plugins/marketplace-reference +- What it settled: Claude Code 的 Git 插件源支持只指定分支或标签 ref。 +- Source: https://developers.openai.com/plugins/build/plugins +- What it settled: Codex 使用 --ref 固定市场目录,Git 插件源支持只指定 ref。 +- Source: https://www.codebuddy.ai/docs/cli/plugin-marketplaces +- What it settled: CodeBuddy 可从已检出的本地仓库注册市场。隔离试装读回所选标签的版本。 + +## In Scope + +- 未来发行标签拓扑、发布检查和安装说明。 + +## Out of Scope + +- 执行正式发布或改写历史标签。 + +## Risks / Deferred Items + +- Claude Code、Codex 和 CodeBuddy 已在隔离配置中读回所选标签的插件版本。dsh 和 Trae 分别记录可验证的入口和限制。 + +## Open Questions + +- 无。 diff --git a/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/reference/host-checks.md b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/reference/host-checks.md new file mode 100644 index 0000000..6d8d0fd --- /dev/null +++ b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/reference/host-checks.md @@ -0,0 +1,26 @@ +# Version selection host evidence + +The isolated installation Git repository published an annotated v9.8.7 tag and then advanced its default branch to plugin version 9.8.8. The tagged catalog carried exactly one Git selector, ref v9.8.7. + +## host-coverage/claude-code + +- Evidence: Claude Code 2.1.311 registered the marketplace using the Git URL with a tag fragment and installed version 9.8.7. The cached manifest matched the tagged version. + +## host-coverage/codex + +- Evidence: Codex CLI 0.167.2 registered the market using --ref v9.8.7 and installed version 9.8.7. The cached manifest matched the tagged version. + +## host-coverage/codebuddy + +- Evidence: CodeBuddy CLI 2.188.1 accepted the checked-out v9.8.7 market as a local directory and installed version 9.8.7. The cached manifest matched the tagged version. +- Limitation: Adding a remote market URL with a tag fragment failed in this setup. + +## host-coverage/dsh + +- Evidence: A checkout made from the public v1.3.0 tag contained package version 1.3.0 and the dsh bundle patch. The documented local-package path uses the selected checkout. +- Limitation: dsh was unavailable for a live install in this environment. + +## host-coverage/trae + +- Evidence: The v1.3.0 tag checkout contained the Trae hook configuration and TaskFlow Skill. The documented copy path takes both from the selected version checkout. +- Limitation: The Trae runtime was not launched. diff --git a/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/spec.md b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/spec.md new file mode 100644 index 0000000..d599253 --- /dev/null +++ b/TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/spec.md @@ -0,0 +1,41 @@ +# Spec — 按标签安装同版本 TaskFlow +> Task version: v1 + +## Objective and Success Criteria + +- 从公共标签读取的两份市场目录均能定位同版有效载荷。 + +## Architecture Boundaries and Responsibilities + +- Git 保存不可变标签和确切对象。市场目录负责分发固定源。release-check 从标签对象独立校验。 + +## Project Structure / Affected Files + +- RELEASE.md、hooks/release-version、hooks/release-check、对应回归以及双语 README 安装段落。 + +## Interfaces, Data Flow, and Contracts + +- release-version 从传入的 X.Y.Z 写两份目录的 ref 为 vX.Y.Z。把目录、插件清单和变更日志纳入同一发布提交。批准后创建带注释的 vX.Y.Z,原子推送 main 和标签。 +- release-check 的发布验证核对 Git 精确标签、两份目录的 ref、清单和变更日志版本。常规 CI 核对当前目录中的有效版本引用。 + +- Claude Code 和 Codex 共用已跟踪的目录。CodeBuddy 核对其独立目录及固定入口。dsh 与 Trae 从用户选择的标签取得发布内容,按各宿主支持的安装方式执行。 + +## Invariants and Compatibility + +- 公共标签固定一个提交。发布检查用完整标签引用,拒绝同名分支及重用版本名。清单的产品版本与标签相符,宿主缓存后缀继续校验。 + +## Validation and Error Semantics + +- 找不到标签、版本不匹配、任一目录仍指向其他版本或多写 SHA 时发布检查失败。原子推送不可用时中止发布并交发行所有者处理。 + +## Code and Test Constraints + +- 检查离线。使用无远端的独立 Git 夹具,不影响真实标签和宿主配置。 + +## Design Decisions and Alternatives + +- 市场目录和插件同在版本标签的快照内。目录中的标签名可在提交前写入,由 Git 在安装时解析。 + +## Open Questions + +- 无。 diff --git a/TaskFlowDocs/todo.md b/TaskFlowDocs/todo.md index c3ea2b1..6004bbf 100644 --- a/TaskFlowDocs/todo.md +++ b/TaskFlowDocs/todo.md @@ -35,6 +35,22 @@ has an issue number or URL. +## 用单一公开标签 vX.Y.Z 安装同版 TaskFlow + +- ID: TF-20261201-0314e6 +- Status: done +- Goal: 让公开版本标签 vX.Y.Z 同时固定市场目录及同版插件,目录只使用该版本引用 +- Task: `TaskFlowDocs/achieved/2026-12-01-versioned-plugin-catalog/` +- Next action: None — completed and archived. + +## 确保 TaskFlow 在开工与评审时提醒适用的仓库规则,并在批准 + +- ID: TF-20261202-34dd60 +- Status: done +- Goal: 确保 TaskFlow 在开工与评审时提醒适用的仓库规则,并在批准与完成时逐项核查仓库声明的要求 +- Task: `TaskFlowDocs/achieved/2026-12-02-repository-rule-checks/` +- Next action: None — completed and archived. + ## 让研究证据支撑研究型任务的 PRD、Spec 和 Plan - ID: TF-20261201-d3ab22 @@ -1443,11 +1459,3 @@ has an issue number or URL. - Task: None — direct docs change in `docs/trae-lang`; the English text now cites the English doc set and its labels, `README.zh-CN.md` keeps the Chinese pair. - Next action: None — completed. -## 确保 TaskFlow 在开工与评审时提醒适用的仓库规则,并在批准 - -- ID: TF-20261202-34dd60 -- Status: done -- Goal: 确保 TaskFlow 在开工与评审时提醒适用的仓库规则,并在批准与完成时逐项核查仓库声明的要求 -- Task: `TaskFlowDocs/achieved/2026-12-02-repository-rule-checks/` -- Next action: None — completed and archived. - diff --git a/hooks/release-check b/hooks/release-check index 9f22418..103607f 100755 --- a/hooks/release-check +++ b/hooks/release-check @@ -1,12 +1,15 @@ #!/usr/bin/env bash # release-check — read-only version-consistency check for a release. -# Usage: release-check [repository-root] +# Usage: release-check [--prepare] [repository-root] # Every version literal a release has to move must agree, and the marketplace pin # must resolve to the commit it names. Not attached to automatic hooks. set -euo pipefail LC_ALL=C export LC_ALL +prepare=no +if [ "${1:-}" = --prepare ]; then prepare=yes; shift; fi +[ "$#" -le 1 ] || { echo 'usage: release-check [--prepare] [repository-root]' >&2; exit 2; } root="${1:-$(git rev-parse --show-toplevel 2>/dev/null || true)}" if [ -z "$root" ] || [ ! -d "$root" ]; then echo "STATUS: blocked" @@ -43,7 +46,7 @@ fi needs=0 echo "Repository: $root" -jversion() { sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$1" | head -1; } +jversion() { sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$@" | head -1; } # Reads one scalar field *inside the plugin's `source` object* rather than # anywhere in the file. A flat "first match wins" scan would silently read the @@ -51,9 +54,11 @@ jversion() { sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' " # second plugin entry, a later `ref`/`sha` pair), and a wrong pin read is # precisely the failure this check exists to catch. The address range bounds the # match to the object. +source_fields() { sed -n '/"source"[[:space:]]*:[[:space:]]*{/,/}/p' "$@"; } jpin() { - sed -n '/"source"[[:space:]]*:[[:space:]]*{/,/}/p' "$1" \ - | sed -n "s/.*\"$2\"[[:space:]]*:[[:space:]]*\"\([^\"]*\)\".*/\1/p" \ + local key="$1"; shift + source_fields "$@" \ + | sed -n "s/.*\"$key\"[[:space:]]*:[[:space:]]*\"\([^\"]*\)\".*/\1/p" \ | head -1 } @@ -247,7 +252,26 @@ EOF check_readme_values README.md "$readme_v" check_readme_values README.zh-CN.md "$readme_zh_v" -# The pin is checked against the tag it names, not against the version literals: +# A published self-pinning catalog and its manifests live in the same tag. +release_tag="v$claude_v" +tag_ref="refs/tags/$release_tag" +# Resolve the exact tag first. Git Bash can rewrite a slash-bearing ref:path +# argument before Git sees it. +tag_commit="$(git rev-parse --verify -q "$tag_ref^{commit}" 2>/dev/null || true)" +check_tagged_release() { + local file tagged version + git rev-parse --verify -q "$tag_ref^{tag}" >/dev/null || { + echo "- $tag_ref is not an annotated release tag" + return 1 + } + for file in "$claude_manifest" "$codex_manifest" "$codebuddy_manifest" "$dsh_manifest"; do + tagged="$(git show "$tag_commit:$file" 2>/dev/null | jversion)" || return 1 + version="${tagged%%+*}" + [ "$version" = "$claude_v" ] || { echo "- $tag_ref:$file has version ${version:-nothing}, expected $claude_v"; return 1; } + done +} + +# Previously published catalogs with a SHA still use their original check. # the marketplace intentionally still points at the previous release while the # next one is being prepared, so a version comparison would fail on the one run # that matters. What must hold is `ref` and `sha` naming the same commit — the @@ -258,11 +282,37 @@ check_readme_values README.zh-CN.md "$readme_zh_v" # would install a different commit depending on which catalog a host reads. Each # catalog's pin is read from its own `source` object so the comparison is # between the two recorded pins, not between a pin and an unrelated field. -window_tag=""; window_sha="" +window_tag=""; window_sha=""; tag_only=0 +if [ "$prepare" = yes ]; then + if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "- Release preparation requires a Git checkout" + needs=1 + elif git show-ref --verify --quiet "$tag_ref"; then + echo "- $tag_ref already exists; choose an unused release version" + needs=1 + fi +fi for catalog in "$marketplace" "$codebuddy_marketplace"; do - pin_ref="$(jpin "$catalog" ref)" - pin_sha="$(jpin "$catalog" sha)" - if [ -z "$pin_ref" ]; then + pin_ref="$(jpin ref "$catalog")" + pin_sha="$(jpin sha "$catalog")" + if [ "$prepare" = yes ] || { [ -n "$pin_ref" ] && ! source_fields "$catalog" | grep -q '^[[:space:]]*"sha"[[:space:]]*:'; }; then + tag_only=$((tag_only + 1)) + if [ "$pin_ref" != "$release_tag" ] || [ -z "$(jpin url "$catalog")" ] || + source_fields "$catalog" | grep -q '^[[:space:]]*"sha"[[:space:]]*:'; then + echo "- $catalog must use ref $release_tag alone" + needs=1 + elif [ "$prepare" = no ]; then + if [ -z "$tag_commit" ] || ! tagged_catalog="$(git show "$tag_commit:$catalog" 2>/dev/null)" || + [ "$(printf '%s\n' "$tagged_catalog" | jpin ref)" != "$release_tag" ] || + printf '%s\n' "$tagged_catalog" | source_fields | grep -q '^[[:space:]]*"sha"[[:space:]]*:' || + [ "$(printf '%s\n' "$tagged_catalog" | jpin url)" != "$(jpin url "$catalog")" ]; then + echo "- $tag_ref:$catalog does not carry the same ref-only plugin source" + needs=1 + else + echo "Marketplace pin ($catalog): $release_tag" + fi + fi + elif [ -z "$pin_ref" ]; then echo "Marketplace pin ($catalog): none recorded" elif ! pin_commit="$(git rev-parse --verify -q "$pin_ref^{commit}" 2>/dev/null)"; then echo "- $catalog ref $pin_ref is not present locally; fetch tags before releasing" @@ -278,6 +328,17 @@ for catalog in "$marketplace" "$codebuddy_marketplace"; do [ -n "$window_sha" ] || { window_tag="$pin_ref"; window_sha="$pin_sha"; } fi done +if [ "$tag_only" -gt 0 ]; then + if [ "$tag_only" -ne 2 ]; then + echo "- Both catalogs must use the same release tag without a SHA" + needs=1 + fi + if git show-ref --verify --quiet "refs/heads/$release_tag"; then + echo "- A branch named $release_tag conflicts with the release tag" + needs=1 + fi + if [ "$prepare" = no ] && ! check_tagged_release; then needs=1; fi +fi # The window between the tagged commit and the commit that recorded the pin. # `RELEASE.md` makes a release two commits by construction — the tag cannot exist @@ -352,4 +413,4 @@ if [ "$needs" -eq 1 ]; then exit 2 else echo "STATUS: pass" -fi \ No newline at end of file +fi diff --git a/hooks/release-version b/hooks/release-version index 8ee9ac2..d6cb410 100644 --- a/hooks/release-version +++ b/hooks/release-version @@ -2,9 +2,8 @@ # release-version — write every mechanical version literal a release has to move. # Usage: release-version [root] # -# A release moves the same version through six files, and seven of the eight -# literals are transcription: the four host bundle manifests, and the two -# `plugin list` sample outputs in each README. Only the `CHANGELOG.md` section is +# A release updates the four host bundle manifests, both marketplace refs, +# and the two `plugin list` sample outputs in each README. The `CHANGELOG.md` section is # prose, so only that is left to the author — and this command refuses to run # until that section exists, which is what binds the prose to the same commit as # the literals. @@ -13,8 +12,7 @@ # writes nothing a release owner's approval covers — see RELEASE.md, which keeps # both the tag and the GitHub Release a manual, approved step. # -# Every check runs before the first byte is written: a refusal leaves all six -# files exactly as they were. +# Every check runs before replacing an input file. set -euo pipefail LC_ALL=C export LC_ALL @@ -40,6 +38,7 @@ codex_manifest=".codex-plugin/plugin.json" codebuddy_manifest=".codebuddy-plugin/plugin.json" dsh_manifest="package.json" readmes="README.md README.zh-CN.md" +catalogs=".claude-plugin/marketplace.json .codebuddy-plugin/marketplace.json" # The value of the manifest's `version` key. Read by field name rather than by # parsing JSON: CODE_STYLE fixes these manifests' shape, and a parser would be a @@ -47,8 +46,8 @@ readmes="README.md README.zh-CN.md" # same key the same way. jversion() { sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$1" | head -1; } -# shellcheck disable=SC2086 # $readmes is a deliberate word list -for file in "$claude_manifest" "$codex_manifest" "$codebuddy_manifest" "$dsh_manifest" $readmes CHANGELOG.md; do +# shellcheck disable=SC2086 # $readmes and $catalogs are deliberate word lists +for file in "$claude_manifest" "$codex_manifest" "$codebuddy_manifest" "$dsh_manifest" $readmes $catalogs CHANGELOG.md; do [ -f "$file" ] || { echo "release-version: missing $file" >&2; exit 3; } done @@ -84,7 +83,7 @@ if ! grep -q "^## \[$new\]" CHANGELOG.md; then fi stamp="$(date +%Y%m%d)" -work="$(mktemp -d)" +work="$(mktemp -d "$(pwd -P)/.release-version.XXXXXX")" trap 'rm -rf "$work"' EXIT : > "$work/stage" literals=0 @@ -98,12 +97,11 @@ manifest_version() { sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".* readme_versions() { sed -n 's/^#.*Version:[[:space:]]*\([^[:space:]]*\).*/\1/p' "$1"; } # stage -# Runs the script into a temp file beside the target and proves the result before +# Runs the script into a temp file on the same filesystem and proves the result before # recording it. Nothing is moved until every file has staged and verified. stage() { - local path="$1" script="$2" expected="$3" dir tmp got all - dir="$(dirname "$path")" - tmp="$(mktemp "$dir/.release-version.XXXXXX")" + local path="$1" script="$2" expected="$3" tmp got all want + tmp="$(mktemp "$work/rewrite.XXXXXX")" if ! sed -f "$script" "$path" > "$tmp"; then rm -f "$tmp" echo "release-version: rewrite of $path failed" >&2 @@ -116,6 +114,16 @@ stage() { got="$(printf '%s\n' "$all" | grep -c -x -F "$expected" || true)" want="$(printf '%s\n' "$all" | grep -c . || true)" ;; + */marketplace.json) + want=1 + got=0 + all="$(sed -n '/"source"[[:space:]]*:[[:space:]]*{/,/}/p' "$tmp")" + if [ "$(printf '%s\n' "$all" | grep -c '^[[:space:]]*"ref"[[:space:]]*:' || true)" -eq 1 ] && + ! printf '%s\n' "$all" | grep -q '^[[:space:]]*"sha"[[:space:]]*:' && + printf '%s\n' "$all" | tail -n 2 | head -n 1 | grep -Eq "^[[:space:]]*\"ref\": \"v${expected//./[.]}\"[[:space:]]*$"; then + got=1 + fi + ;; *) want=1 got=0 @@ -173,6 +181,19 @@ for readme in $readmes; do stage "$readme" "$script" "$new" done +# The version ref is known before the tagged commit exists. +script="$work/catalog.sed" +cat > "$script" < "$rv/CHANGELOG.md" printf '# Readme\n\n```bash\n# taskflow@taskflow Version: 9.9.9 Status: enabled\n```\n\n```bash\n# Version: 9.9.9\n```\n' > "$rv/README.md" cp "$rv/README.md" "$rv/README.zh-CN.md" +printf '{\n "plugins": [\n {\n "source": {\n "source": "url",\n "url": "https://example.invalid/taskflow.git",\n "ref": "v9.9.9",\n "sha": "0123456789012345678901234567890123456789"\n }\n }\n ]\n}\n' > "$rv/.claude-plugin/marketplace.json" +cp "$rv/.claude-plugin/marketplace.json" "$rv/.codebuddy-plugin/marketplace.json" # Each refusal is checked by digest, so "refused" cannot mean "wrote half of it". # The captured output lives in `$tmp`, not in the fixture: anything written @@ -6790,8 +6792,8 @@ grep -q '"version": "9.9.9"' "$rv_done/.claude-plugin/plugin.json" \ # agrees immediately. That agreement is the point — no second edit, no drift. printf '# Changelog\n\n## [9.9.10] — 2026-09-15\n\nNew.\n' > "$rv/CHANGELOG.md" bash "$HERE/release-version" 9.9.10 "$rv" >"$tmp/rv-out" 2>&1 || { echo "FAIL release-version refused a valid release:"; cat "$tmp/rv-out"; exit 1; } -grep -q 'release-version OK: 9.9.9 -> 9.9.10 (8 literals in 6 files)' "$tmp/rv-out" \ - || { echo "FAIL release-version did not report all eight literals"; cat "$tmp/rv-out"; exit 1; } +grep -q 'release-version OK: 9.9.9 -> 9.9.10 (10 literals in 8 files)' "$tmp/rv-out" \ + || { echo "FAIL release-version did not report all ten literals"; cat "$tmp/rv-out"; exit 1; } grep -q '"version": "9.9.10"' "$rv/.claude-plugin/plugin.json" || { echo "FAIL claude manifest not written"; exit 1; } grep -q '"version": "9.9.10"' "$rv/package.json" || { echo "FAIL dsh manifest not written"; exit 1; } # The cachebuster survives with today's date, not the fixture's old one. @@ -6810,9 +6812,33 @@ grep -q '"node": "9.9.9"' "$rv/.claude-plugin/plugin.json" \ git -C "$rv" init -q git -C "$rv" config user.email smoke@example.invalid git -C "$rv" config user.name smoke +bash "$HERE/release-check" --prepare "$rv" >"$tmp/rv-out" 2>&1 || { cat "$tmp/rv-out"; exit 1; } +if bash "$HERE/release-check" "$rv" >"$tmp/rv-out" 2>&1; then + echo "FAIL ref-only catalogs without a published tag passed"; exit 1 +fi git -C "$rv" add -A git -C "$rv" commit -qm release -git -C "$rv" tag v9.9.10 +git -C "$rv" branch v9.9.10 +if bash "$HERE/release-check" --prepare "$rv" >"$tmp/rv-out" 2>&1; then + echo "FAIL a same-name branch was accepted for release"; exit 1 +fi +git -C "$rv" branch -D v9.9.10 >/dev/null +git -C "$rv" tag -a v9.9.10 -m "TaskFlow 9.9.10" +bash "$HERE/release-check" "$rv" >"$tmp/rv-out" 2>&1 || { echo "FAIL single-tag release rejected:"; cat "$tmp/rv-out"; exit 1; } +rv_remote="$tmp/release-version-remote.git" +git init -q --bare "$rv_remote" +git -C "$rv" push -q --atomic "$rv_remote" HEAD:refs/heads/main refs/tags/v9.9.10:refs/tags/v9.9.10 +if [ "$(git --git-dir="$rv_remote" rev-parse refs/heads/main)" != "$(git --git-dir="$rv_remote" rev-parse 'refs/tags/v9.9.10^{commit}')" ]; then + echo "FAIL the single published tag and main point at different commits"; exit 1 +fi +if bash "$HERE/release-check" --prepare "$rv" >"$tmp/rv-out" 2>&1; then + echo "FAIL an existing published version was accepted for preparation"; exit 1 +fi +sed 's/"ref": "v9\.9\.10"/"ref": "v9.9.9"/' "$rv/.claude-plugin/marketplace.json" > "$rv/.codebuddy-plugin/marketplace.json" +if bash "$HERE/release-check" "$rv" >"$tmp/rv-out" 2>&1; then + echo "FAIL a ref-only catalog still pointing at the previous version passed"; exit 1 +fi +# Keep the original legacy pin-window regression below. printf '{\n "plugins": [\n {\n "source": {\n "ref": "v9.9.10",\n "sha": "%s"\n }\n }\n ]\n}\n' "$(git -C "$rv" rev-parse HEAD)" \ > "$rv/.claude-plugin/marketplace.json" cp "$rv/.claude-plugin/marketplace.json" "$rv/.codebuddy-plugin/marketplace.json" @@ -6892,17 +6918,12 @@ git -C "$pv" add -A git -C "$pv" commit -qm 'point $schema at a working URL' bash "$HERE/release-check" "$pv" >"$tmp/rv-out" 2>&1 || { echo "FAIL a catalog edit after the pin was reported as a stray:"; cat "$tmp/rv-out"; exit 1; } grep -q 'STATUS: pass' "$tmp/rv-out" || { echo "FAIL a post-pin catalog edit did not pass"; cat "$tmp/rv-out"; exit 1; } -# The release format is the repository's, and it lives in `RELEASE.md` rather than -# in a convention people remember: the tag name, the tag subject / release title, -# and the body's first line. Each is pinned separately because each is a separate -# thing an operator types, and the 1.0.x/1.1.x split is exactly how one of them -# drifted unnoticed for eleven releases. +# Keep the tag, title and first line requirements in the release procedure. repo_root="$repo" for rel_pin in 'annotated tag named `vX.Y.Z`' \ - 'whose subject line is' \ - 'The release title is' \ - 'before the summary and the release record below' \ - 'the eleven `1.1.x` releases are what the' ; do + 'git tag -a vX.Y.Z -m "TaskFlow X.Y.Z"' \ + 'with title `TaskFlow X.Y.Z`' \ + 'with `TaskFlow X.Y.Z — YYYY-MM-DD`' ; do grep -q -F -- "$rel_pin" "$repo_root/RELEASE.md" \ || { echo "FAIL RELEASE.md no longer states the release format: $rel_pin"; exit 1; } done