yadflow 4.8.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/README.md +4 -3
  3. package/bin/commands.mjs +7 -0
  4. package/bin/yad.mjs +123 -8
  5. package/cli/agent-guard.mjs +793 -65
  6. package/cli/agent-rules.mjs +40 -5
  7. package/cli/argv-flags.mjs +1 -1
  8. package/cli/build.mjs +1 -1
  9. package/cli/ci-check.mjs +45 -1
  10. package/cli/codeowners-command.mjs +72 -6
  11. package/cli/commit.mjs +17 -3
  12. package/cli/docs.mjs +2 -0
  13. package/cli/doctor.mjs +176 -12
  14. package/cli/epic-state.mjs +94 -4
  15. package/cli/epic.mjs +11 -7
  16. package/cli/fold.mjs +31 -6
  17. package/cli/guide.mjs +3 -1
  18. package/cli/hook.mjs +50 -7
  19. package/cli/issue-links.mjs +61 -0
  20. package/cli/issues-act.mjs +327 -0
  21. package/cli/issues-write.mjs +428 -0
  22. package/cli/issues.mjs +474 -0
  23. package/cli/lifecycle.mjs +7 -0
  24. package/cli/machine.mjs +141 -0
  25. package/cli/manifest.mjs +9 -3
  26. package/cli/openpr.mjs +69 -9
  27. package/cli/plan.mjs +2 -0
  28. package/cli/platform.mjs +157 -2
  29. package/cli/preview.mjs +253 -0
  30. package/cli/protection.mjs +21 -3
  31. package/cli/reconcile.mjs +1 -1
  32. package/cli/repo.mjs +64 -3
  33. package/cli/review.mjs +4 -0
  34. package/cli/run-checks.mjs +10 -2
  35. package/cli/scan.mjs +314 -0
  36. package/cli/setup.mjs +12 -3
  37. package/cli/standup.mjs +33 -7
  38. package/cli/story-frames.mjs +307 -0
  39. package/cli/test-agents-file.mjs +378 -11
  40. package/cli/test-build.mjs +25 -0
  41. package/cli/test-ci-check.mjs +469 -10
  42. package/cli/test-guide.mjs +7 -0
  43. package/cli/test-machine.mjs +140 -0
  44. package/cli/test-node.mjs +15 -0
  45. package/cli/test-preview.mjs +511 -0
  46. package/cli/test-run-checks.mjs +17 -0
  47. package/cli/test-setup-agent.mjs +14 -0
  48. package/cli/test-story-frames.mjs +409 -0
  49. package/cli/toolbox-connect.mjs +244 -0
  50. package/cli/toolbox.mjs +159 -5
  51. package/package.json +7 -3
  52. package/skills/sdlc/config.yaml +1 -1
  53. package/skills/sdlc/module-help.csv +3 -1
  54. package/skills/yad-analysis/SKILL.md +4 -0
  55. package/skills/yad-backfill/SKILL.md +4 -0
  56. package/skills/yad-change/SKILL.md +4 -0
  57. package/skills/yad-checks/SKILL.md +13 -7
  58. package/skills/yad-checks/references/check-gates.md +62 -30
  59. package/skills/yad-checks/templates/checks/member-check.mjs +3 -2
  60. package/skills/yad-checks/templates/checks/risk-map-check.sh +2 -2
  61. package/skills/yad-checks/templates/checks/verified-commits.sh +3 -3
  62. package/skills/yad-checks/templates/github/yad-checks.yml +357 -69
  63. package/skills/yad-checks/templates/github/yad-pr-text.yml +118 -0
  64. package/skills/yad-checks/templates/github/yad-product-checks.yml +130 -54
  65. package/skills/yad-checks/templates/github/yad-product-pr-text.yml +131 -0
  66. package/skills/yad-checks/templates/github/yad-update-guard.yml +2 -1
  67. package/skills/yad-checks/templates/github/yad-verified-commits.yml +49 -3
  68. package/skills/yad-checks/templates/gitlab/yad-checks.gitlab-ci.yml +79 -20
  69. package/skills/yad-checks/templates/gitlab/yad-product-checks.gitlab-ci.yml +59 -9
  70. package/skills/yad-checks/templates/gitlab/yad-update-guard.gitlab-ci.yml +1 -0
  71. package/skills/yad-checks/templates/gitlab/yad-verified-commits.gitlab-ci.yml +49 -1
  72. package/skills/yad-checks/templates/hooks/agent-guard.mjs +44 -10
  73. package/skills/yad-checks/templates/hooks/ledger-guard-cursor.mjs +12 -6
  74. package/skills/yad-commit/SKILL.md +3 -1
  75. package/skills/yad-connect-design/SKILL.md +48 -13
  76. package/skills/yad-connect-design/references/design-context.md +56 -3
  77. package/skills/yad-connect-design/references/design-registry.md +4 -4
  78. package/skills/yad-connect-learning/SKILL.md +12 -2
  79. package/skills/yad-connect-repos/SKILL.md +12 -0
  80. package/skills/yad-connect-testing/SKILL.md +22 -5
  81. package/skills/yad-connect-testing/references/testing-context.md +1 -1
  82. package/skills/yad-engineer-review/SKILL.md +13 -0
  83. package/skills/yad-epic/SKILL.md +4 -0
  84. package/skills/yad-epic/references/state-schema.md +21 -0
  85. package/skills/yad-guide/SKILL.md +8 -4
  86. package/skills/yad-implement/SKILL.md +69 -3
  87. package/skills/yad-implement/references/implement-conventions.md +2 -1
  88. package/skills/yad-issues/SKILL.md +53 -0
  89. package/skills/yad-learn/SKILL.md +4 -0
  90. package/skills/yad-open-pr/SKILL.md +10 -1
  91. package/skills/yad-pair-review/SKILL.md +5 -0
  92. package/skills/yad-pr-template/SKILL.md +2 -1
  93. package/skills/yad-pr-template/templates/checks/pr-title.sh +34 -2
  94. package/skills/yad-pr-template/templates/github/pull_request_template.md +1 -0
  95. package/skills/yad-pr-template/templates/gitlab/merge_request_templates/Default.md +1 -0
  96. package/skills/yad-product-bridge/references/bridge.md +28 -0
  97. package/skills/yad-product-bridge/templates/github/yad-gate-sync.yml +25 -11
  98. package/skills/yad-product-bridge/templates/gitlab/yad-gate-sync.gitlab-ci.yml +38 -14
  99. package/skills/yad-review-companion/SKILL.md +4 -1
  100. package/skills/yad-run/SKILL.md +5 -0
  101. package/skills/yad-scan/SKILL.md +51 -0
  102. package/skills/yad-spec/SKILL.md +32 -0
  103. package/skills/yad-stories/SKILL.md +22 -0
  104. package/skills/yad-stories/references/story-schema.md +1 -0
  105. package/skills/yad-test-cases/SKILL.md +18 -2
  106. package/skills/yad-ui/SKILL.md +48 -8
  107. package/skills/yad-checks/templates/gitlab/.gitlab-ci.yml +0 -49
@@ -139,15 +139,20 @@ and GitLab CI. This step is **by hand** in Phase 3 — run the gates with the sk
139
139
  → the standalone Product-side verified-commits CI (installed by `yad check --fix` with the Product wiring)
140
140
  - `templates/github/yad-checks.yml` → installs to `.github/workflows/yad-checks.yml` (marked `# yad-managed: yad-checks`);
141
141
  its quality job uses `install-deps.sh`, reads the optional `YAD_NODE_VERSION` repository variable,
142
- exports the PR's exact `NX_BASE`/`NX_HEAD`, and filters unrelated history blobs while preserving
143
- the full commit graph.
142
+ exports the PR's exact `NX_BASE`/`NX_HEAD`, and checks out the full history. It never starts on
143
+ `edited` (#425): a gate job skipped on an edit counts as passed, so an edit of the PR text could turn
144
+ a failed gate green. Every PR gate job (both platforms) runs the base branch's copy of `checks/`
145
+ through `"$YAD_CHECKS/…"`, never the PR's own, and keeps no token in the checkout (#426) — except
146
+ `yad-update-guard`, which runs on a direct push to the default branch;
147
+ advise the CODEOWNERS lines in `docs/branch-protection.md` ("Who may change the gates") — never
148
+ write CODEOWNERS.
149
+ - `templates/github/yad-pr-text.yml` → `.github/workflows/yad-pr-text.yml`: `pr-title` + `pr-template`,
150
+ the only checks that re-run on an edit of the PR title or body. The Product gets
151
+ `templates/github/yad-product-pr-text.yml` (`--profile product`) beside `yad-product-checks.yml`.
144
152
  - `templates/gitlab/yad-checks.gitlab-ci.yml` → includable fragment, installs to `.gitlab/ci/yad-checks.yml`;
145
153
  it uses the same installer, honors a project/group `YAD_NODE_VERSION` CI/CD variable, and exports
146
154
  the MR's exact `NX_BASE`/`NX_HEAD`.
147
155
  - `templates/gitlab/gitlab-ci.include-root.yml` → minimal root written only when no root `.gitlab-ci.yml` exists
148
- - `templates/gitlab/.gitlab-ci.yml` → legacy standalone root (greenfield single-file option), kept
149
- semantically aligned with the includable fragment's Node version, Nx range, dependency install,
150
- and test-worker cap
151
156
  - The gates depend on the conventions from earlier steps: the `Task:`/`Contract-Change:` commit
152
157
  trailers (`yad-implement`), the `specs/<story>/link.md` + `contracts/` slice (`yad-spec`), and the
153
158
  locked `contract.md` (`yad-architecture`).
@@ -183,6 +188,7 @@ Copy from this skill's `templates/`:
183
188
  - A **foreign** file occupies that path/name → write to a non-colliding filename
184
189
  (`yad-checks.gen.yml`) and ensure its `name:` does not clash. Never merge jobs into a foreign
185
190
  workflow; never edit one.
191
+ - Also install `templates/github/yad-pr-text.yml` → `.github/workflows/yad-pr-text.yml` the same way.
186
192
  - Also install `templates/github/yad-update-guard.yml` → `.github/workflows/yad-update-guard.yml`
187
193
  (marker `# yad-managed: yad-checks`) — the push-on-default integrity gate for direct-to-default
188
194
  commits (`yad update --push`); it runs only `verified-commits` + `commit-message`. Same
@@ -201,8 +207,8 @@ Copy from this skill's `templates/`:
201
207
  `- local: '.gitlab/ci/yad-update-guard.yml'` to the root `include:` the same additive, idempotent way.
202
208
  - If the existing YAML cannot be parsed safely → **STOP** and print the exact include snippet for the
203
209
  human to paste (graceful degradation — never guess-edit a pipeline you cannot parse).
204
- - The legacy standalone `templates/gitlab/.gitlab-ci.yml` is retained only for a clean greenfield repo
205
- that prefers a single self-contained file; the include path above is the default.
210
+ - A greenfield repo with no root `.gitlab-ci.yml` gets `gitlab-ci.include-root.yml` (above) plus the
211
+ fragments — there is no single-file template (the old one, with 4 of the 11 gates, was removed in #434).
206
212
  - **CI/CD variables, tokens and branch protection are the person's (E158).** An AI agent gives them
207
213
  the steps below, never sets one itself, and confirms by reading once they say it is done.
208
214
  `yad doctor` reads branch protection and where `YAD_PRODUCT_TOKEN` is set; it cannot read the
@@ -330,8 +330,9 @@ signature-checked parent, so there is nothing to protect. This unblocks **self-h
330
330
  does not sign UI-created merge commits (the signature API returns 404) — without it every routine merge
331
331
  would red the branch. A merge that *does* introduce content of its own still requires a verified
332
332
  signature (fail-closed), so an evil merge pushed direct-to-default cannot smuggle in unverified changes.
333
- This matters for the push-on-default `yad-update-guard` (§9), which — unlike this PR-triggered gate —
334
- sees merge commits.
333
+ This matters for the push-on-default `yad-update-guard` (§9), and for this PR-triggered gate too: a
334
+ GitHub `pull_request` run and a GitLab merged-results pipeline check a merge the platform made, which is
335
+ unsigned and content-free (#433).
335
336
 
336
337
  Degradation is explicit, never silent: no GitHub/GitLab remote SKIPs the signature check (the badge is a
337
338
  platform concept — this keeps local runs and tests meaningful); an unreachable platform API **fails
@@ -367,6 +368,10 @@ from the event payload):
367
368
  - `--profile code` (default) → a Conventional-Commits subject `<type>: <description>`, no trailing
368
369
  period (`config.yaml build.pr_title_style: same_as_commit_subject` — one task = one PR, the title is
369
370
  the squash-merge subject).
371
+ - **A GitLab draft** (#451): in GitLab CI (`GITLAB_CI=true`) a leading `Draft:`, `[Draft]` or
372
+ `(Draft)` (any case, repeats too) is stripped before the title is judged, with a `note`. GitLab removes
373
+ it when the MR is marked ready, which starts no pipeline, so the draft-time result is the one that
374
+ stands. Outside GitLab CI (GitHub, `yad run checks`) the title is judged as written.
370
375
  - `--profile product` (old name `hub`, still accepted) → splits by the PR/MR **head branch** (passed via `--head`, injected by CI):
371
376
  - `review/EP-*` head (or no `--head` — stays strict) → a Shape artifact-review title
372
377
  `review: <artifact> (EP-<slug>)`, the shape `yad gate open` creates.
@@ -643,9 +648,9 @@ someone who has worked in any of them meets the ask, and the output never says w
643
648
  `FILES`, `LEVEL`, `DIR <dir> <level> <state>`, `WHO <login|-> <name>`, `HISTNONE` — the history was read
644
649
  and held nobody — and `HISTUNKNOWN <why>`) for `checks/risk-route.sh`, which joins it with the PR
645
650
  body. One awk program serves both the warnings and the count. Its twin is `changeLevel` in
646
- `cli/riskmap.mjs`, and a parity test compares the two. **Known limits:** like every check here, the
647
- script runs from the PR's own checkout, so a PR can edit the script itself; that is harmless only because nothing
648
- blocks on the count — the Build count stays reported, and branch protection holds the merge (E72). And, as for the warnings, a path holding a newline is
651
+ `cli/riskmap.mjs`, and a parity test compares the two. **Known limits:** CI runs the base branch's copy of the
652
+ script (#426), but the workflow that calls it comes from the PR, so the count is only as safe as the code owner
653
+ review of the gate files; that is enough only because nothing blocks on the count — the Build count stays reported, and branch protection holds the merge (E72). And, as for the warnings, a path holding a newline is
649
654
  split in two here but kept whole by `changeLevel`, so the bash count can read its second half as a file
650
655
  at the root; the error can only raise the count, never lower it. (The E67 history is free of that class:
651
656
  it reads no file names at all.) If git itself fails, each step of the
@@ -656,43 +661,64 @@ count says "not counted"; the E65 warnings half is not guarded the same way, so
656
661
 
657
662
  The gates run identically under either CI; the config just invokes the scripts with the PR/MR base.
658
663
 
664
+ - **The base branch's scripts (#426).** CI never runs the PR's own `checks/`. Each gate job first copies
665
+ `checks/` from `origin/<base>` into a temp folder outside the work tree (`git archive`), and every call
666
+ is `bash "$YAD_CHECKS/<gate>.sh"` (`node "$YAD_CHECKS/member-check.mjs"`) with the PR's tree as the
667
+ working folder — so a PR that edits a gate script is still judged by the merged one. A script the base
668
+ does not have yet runs from the PR, with a `note:` line: one per file, or one line when the base has no
669
+ `checks/` at all (the PR that installs the gates). A link in the PR's `checks/` is never followed. An
670
+ `origin/<base>` that is not in the checkout FAILs the job (`FAIL [base-checks]`) — it never falls back
671
+ to the PR's copies. GitHub runs this as a step named "Gate scripts from the base branch (#426)" in each
672
+ job, exporting `YAD_CHECKS` through `$GITHUB_ENV`; GitLab as the first line of every gate job's `script:`
673
+ (`!reference [.yad_base_checks, script]`, GitLab 13.9 or later) — not a `before_script`, which would replace the host
674
+ pipeline's `default: before_script` for these jobs (registry auth, proxies). The step's text is the same everywhere, and a test holds it. The base's script runs with
675
+ the new file's call, so a call may only use what the previous release's script accepts (a test holds
676
+ that list too). The CI file itself still comes from the PR: the CODEOWNERS lines in
677
+ `docs/branch-protection.md` ("Who may change the gates") cover it.
678
+ - **No token left in the checkout (#426).** Every `actions/checkout` sets `persist-credentials: false`, so
679
+ code a job runs (the team's tests) finds no `GITHUB_TOKEN` in `.git/config`. No gate needs one there:
680
+ `product-checkout.sh` clones with its own token, and the base was fetched by `fetch-depth: 0`.
681
+
659
682
  - **GitHub Actions** — `templates/github/yad-checks.yml` → `.github/workflows/yad-checks.yml`. The
660
683
  jobs run on `pull_request` with `fetch-depth: 0`, passing `origin/${{ github.base_ref }}` as base
661
684
  (verified-commits also gets a read-only `GH_TOKEN` for the Verified-badge lookup). The trigger sets
662
- `types: [opened, synchronize, reopened, edited]` — the extra `edited` so a title/body correction
663
- re-runs the pattern gates without a close/reopen (a plain re-run replays the frozen original payload).
664
- The commit-range jobs carry `if: github.event.action != 'edited'` so a bare body/title edit only
665
- re-runs `pr-title`/`pr-template`, not the whole suite. The pattern jobs
685
+ `types: [opened, synchronize, reopened]` — never `edited` (#425): a job skipped by `if:` counts as
686
+ passed, so a run started by an edit of the PR text would turn a failed gate green. The two jobs that read
687
+ the PR text, `pr-title` and `pr-template`, live in `templates/github/yad-pr-text.yml` →
688
+ `.github/workflows/yad-pr-text.yml`, which adds `edited`, so a title/body correction re-runs them
689
+ without a close/reopen (a plain re-run replays the frozen original payload). The pattern jobs
666
690
  read the title/body from the event payload: `pr-title` takes `${{ github.event.pull_request.title }}`
667
691
  and `pr-template` writes `${{ github.event.pull_request.body }}` to a temp file. All `--profile code`.
668
692
  The Phase 6 thread gates (`lineage-check`, `epic-open`, `reconcile-debt`) and the advisory `risk-map`
669
- check run as their own jobs with `fetch-depth: 0`, the same `origin/${{ github.base_ref }}` base. The build/test/lint checkout also
670
- uses `filter: blob:none`; its installer follows `package.json#packageManager`, and `NX_BASE` /
693
+ check run as their own jobs with `fetch-depth: 0`, the same `origin/${{ github.base_ref }}` base. The build/test/lint checkout takes the
694
+ full history with no `filter: blob:none` (#426): a blob-less clone leaves out the base's `checks/`
695
+ when the PR changed them, and with no token kept the base-copy step could not fetch them. Its installer follows `package.json#packageManager`, and `NX_BASE` /
671
696
  `NX_HEAD` carry the exact base/head SHAs so Nx affected commands evaluate the PR rather than a
672
697
  stale default. `YAD_NODE_VERSION` is read from GitHub repository variables with `22` as the default.
673
698
  Dependencies are cached with `actions/cache` (npm's `~/.npm`, pnpm's store, and the Corepack home
674
699
  holding the pinned manager, keyed on the lockfiles and package.json) rather than setup-node's
675
700
  npm-only `cache:`, which must name the manager before package.json has been read.
676
- - **Pinned actions, read-only token.** Every `uses:` in the GitHub templates names a commit SHA, with
677
- the version after it in a comment (`actions/checkout@<sha> # v4.4.0`). A tag such as `@v4` can be
678
- moved to other code; a SHA cannot. Each workflow also sets a top-level `permissions:` block that is
679
- read-only, so no job gets write access unless it asks for it. If your own Dependabot bumps a SHA in
680
- an installed copy that `.sdlc/managed.json` records, `yad check` then reports that file as
681
- `modified`, and `yad update` keeps your copy rather than overwriting it — so that file stops
682
- receiving template changes. (`--overwrite-local` replaces it after saving `<file>.yad-orig`; a copy
683
- with no record reads as `outdated`, and a plain `yad update` replaces it, saving `<file>.yad-orig`
684
- first.) To stay on the template, leave the pins to yadflow releases.
701
+ - **Pinned actions, read-only token.** Every `uses:` in the GitHub templates names a commit SHA, with the
702
+ version after it in a comment (`actions/checkout@<sha> # v7.0.1`). A tag such as `@v4` can be moved to
703
+ other code; a SHA cannot. Each workflow also sets a top-level `permissions:` block that is read-only, so
704
+ no job gets write access unless it asks for it. These actions run on Node 24, so a self-hosted runner,
705
+ or GitHub Enterprise Server, needs Actions runner 2.327.1 or newer (GitHub's own runners already have
706
+ it). If your own Dependabot bumps a SHA in an installed copy that `.sdlc/managed.json` records, `yad
707
+ check` then reports that file as `modified`, and `yad update` keeps your copy rather than overwriting it
708
+ — so that file stops receiving template changes. (`--overwrite-local` replaces it after saving
709
+ `<file>.yad-orig`; a copy with no record reads as `outdated`, and a plain `yad update` replaces it,
710
+ saving `<file>.yad-orig` first.) To stay on the template, leave the pins to yadflow releases.
685
711
  - **GitLab CI** — `templates/gitlab/yad-checks.gitlab-ci.yml` → `.gitlab/ci/yad-checks.yml`, pulled in
686
712
  by the root `.gitlab-ci.yml`'s `include:`. The jobs run on `merge_request_event` with `GIT_DEPTH: 0`,
687
713
  passing `origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME`; the pattern jobs read `$CI_MERGE_REQUEST_TITLE`
688
714
  and `$CI_MERGE_REQUEST_DESCRIPTION`. The quality job uses the same package-manager-aware installer;
689
715
  `NX_BASE=$CI_MERGE_REQUEST_DIFF_BASE_SHA` and `NX_HEAD=$CI_COMMIT_SHA` provide the equivalent Nx
690
716
  range. Its `node:${YAD_NODE_VERSION}` image defaults to `22` and a project/group CI/CD variable may
691
- override it without editing the managed fragment. Those three variables sit on the `.sdlc_mr_only`
692
- anchor, not the fragment's top-level `variables:` — an included top-level block merges into the host
693
- pipeline's globals, where `NX_BASE`/`NX_HEAD` could collide with a host's own Nx setup. The retained greenfield standalone template
694
- (`templates/gitlab/.gitlab-ci.yml`) carries the same Node default, exact Nx range, and dependency
695
- installer and test-worker-cap semantics. All `--profile code`.
717
+ override it without editing the managed fragment. Those three variables and `GIT_DEPTH` sit on the
718
+ `.sdlc_mr_only` anchor, not a top-level `variables:` — an included top-level block merges into the host
719
+ pipeline's globals, where `NX_BASE`/`NX_HEAD` could collide with a host's own Nx setup, and where
720
+ `GIT_DEPTH: 0` made every host job clone the full history while a host's own `GIT_DEPTH` replaced it
721
+ (#434). No yad GitLab fragment has a top-level `variables:`. All `--profile code`.
696
722
 
697
723
  ### Checking the Product out in CI (E120)
698
724
 
@@ -717,9 +743,11 @@ itself, then confirms by reading (`yad doctor`) once they say it is done (E158).
717
743
  3. Add it to the **code repo** as the `YAD_PRODUCT_TOKEN` secret (GitHub: Settings → Secrets and
718
744
  variables → Actions; GitLab: Settings → CI/CD → Variables, **masked**).
719
745
 
720
- **Who can read the token.** The workflow runs on the PR's own copy of `checks/product-checkout.sh`, so
721
- anyone who can push a branch to the code repo can read `YAD_PRODUCT_TOKEN` — edit the script, open a
722
- PR. (A PR from a fork gets no secret, and defers.) So give it **read** access to the Product repository
746
+ **Who can read the token.** The workflow runs the base branch's copy of `checks/product-checkout.sh`
747
+ (#426), so editing the script in a PR does not reach it. But a PR's workflow runs before any review:
748
+ anyone who can push a branch can add or change a workflow that prints `YAD_PRODUCT_TOKEN`, whatever
749
+ CODEOWNERS says — a code owner guards the merge, not the run (`docs/branch-protection.md`, "Who may
750
+ change the gates"). (A PR from a fork gets no secret, and defers.) So give it **read** access to the Product repository
723
751
  and nothing else. On GitLab, a variable marked **protected** is not handed to pipelines of unprotected
724
752
  branches, so merge requests from feature branches would defer: leave it unprotected, masked, and
725
753
  read-only.
@@ -789,7 +817,9 @@ The Product is itself a repo on a platform (recorded in `.sdlc/product.json` by
789
817
  `yad-connect-repos action: detect-product`). `wire repo: product` targets `{project-root}` and uses the same
790
818
  merge-not-clobber logic, with a **Product-flavored gate set** appropriate to a "thinking" repo (it has no
791
819
  `specs/` or `package.json` build). **What yadflow wires today** (`PRODUCT_WIRING`): `commit-message`,
792
- `pr-title`, `pr-template` and `ledger-guard` in `yad-product-checks`, `verified-commits` in its own workflow,
820
+ `ledger-guard` and `member-check` in `yad-product-checks`, `pr-title` and `pr-template` in
821
+ `yad-product-pr-text` on GitHub (the only Product file that re-runs on an edit of the PR text, #425; on GitLab they
822
+ are jobs in `yad-product-checks`), `verified-commits` in its own workflow,
793
823
  and the `yad-update-guard`. On GitHub the `ledger-guard` job is given **no** `GH_TOKEN` on purpose: its
794
824
  bot exemption checks the author text and the Verified badge, and the badge proves only that the
795
825
  *committer* signed, so any contributor who signs could claim the bot's name. Without a token the badge
@@ -830,7 +860,9 @@ title + the code task template), so a PR that changes the Product's own workflow
830
860
  `yad check --fix` installs the same `checks/*.sh` scripts plus a standalone Product workflow
831
861
  (`templates/github/yad-product-checks.yml` → `.github/workflows/yad-product-checks.yml`, or the GitLab fragment
832
862
  `templates/gitlab/yad-product-checks.gitlab-ci.yml` → `.gitlab/ci/yad-product-checks.yml` + its one include
833
- line). Code repos run the same three with `--profile code` inside the main `yad-checks` workflow.
863
+ line), and on GitHub `templates/github/yad-product-pr-text.yml` → `.github/workflows/yad-product-pr-text.yml`
864
+ for `pr-title` and `pr-template`. Code repos run the same three with `--profile code`: `commit-message` in
865
+ the main `yad-checks` workflow, the other two in `yad-pr-text` (GitHub) or `yad-checks` (GitLab).
834
866
 
835
867
  ## The agent guardrail (`templates/hooks/ledger-guard.mjs` + `yad hook ledger-guard`)
836
868
 
@@ -22,8 +22,9 @@
22
22
  // case or Unicode twin of `.sdlc/members/` — a macOS or Windows checkout would read either as a member
23
23
  // file this gate never judged (E131 review 1–2; the E115 and E121 lessons).
24
24
  //
25
- // LIMIT: like every Product gate, this file and the workflow that runs it come from the PR's own checkout,
26
- // so a PR can change the gate it is judged by; branch protection on the default branch is the backstop.
25
+ // LIMIT: CI runs the base branch's copy of this file (#426), but the workflow that runs it comes from the
26
+ // PR, so a PR that changes the workflow can change the gate it is judged by; a required code owner review
27
+ // of the gate files (docs/branch-protection.md, "Who may change the gates") is the backstop.
27
28
  //
28
29
  // A Node script, not bash: it reads JSON and hashes, and both CI images already have Node (E113's hooks are
29
30
  // Node for the same reason). Usage: node checks/member-check.mjs <base-ref>
@@ -7,8 +7,8 @@
7
7
  # It also COUNTS (E66): a change touching a `high` directory adds the high step, +1 approver, printed as
8
8
  # a `COUNT [risk-map]:` line. The count reads the map on the BASE branch, never this change's copy, so a
9
9
  # change cannot lower its own count by editing the map. It is reported, never enforced: a Build merge is
10
- # held by the platform's branch protection, and this script runs from the PR's own checkout, so a PR could
11
- # edit it — harmless only because nothing blocks on it (E72). It cannot apply the capacity cap either: the
10
+ # held by the platform's branch protection. CI runs the base branch's copy of this script (#426), but the
11
+ # workflow that calls it comes from the PR — harmless only because nothing blocks on the count (E72). It cannot apply the capacity cap either: the
12
12
  # cap needs the Product's count of active people, which a code repo's CI does not have; `yad open-pr`
13
13
  # shows the capped count. A `guessed` level counts as a `confirmed` one;
14
14
  # an `unset` line and an uncovered directory add nothing. The change's files for the count include
@@ -135,7 +135,7 @@ signature_verified() {
135
135
  gitlab)
136
136
  # In CI use the documented API directly; locally fall back to the user's own glab.
137
137
  if [ -n "${CI_API_V4_URL:-}" ] && [ -n "${CI_PROJECT_ID:-}" ]; then
138
- body="$(curl -fsS --header "PRIVATE-TOKEN: ${GITLAB_TOKEN:-${SDLC_API_TOKEN:-}}" \
138
+ body="$(curl -fsS --max-time 15 --header "PRIVATE-TOKEN: ${GITLAB_TOKEN:-${SDLC_API_TOKEN:-}}" \
139
139
  "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/commits/${sha}/signature" 2>/dev/null || true)"
140
140
  else
141
141
  body="$(glab api "projects/:id/repository/commits/${sha}/signature" 2>/dev/null || true)"
@@ -167,8 +167,8 @@ while IFS= read -r sha; do
167
167
  # A merge commit (2+ parents) whose content is all in its parents may go unsigned — see
168
168
  # merge_introduces_no_content. Every other commit, merges with content of their own included, needs
169
169
  # the signature: a platform merge commit is Verified, so a locally-forged merge pushed
170
- # direct-to-default cannot dodge the check. This matters for the push-on-default yad-update-guard,
171
- # which (unlike the PR-triggered gates) sees merge commits.
170
+ # direct-to-default cannot dodge the check. The PR-triggered gates see one too: a GitHub pull_request run
171
+ # and a GitLab merged-results pipeline check a merge the platform made, unsigned and content-free (#433).
172
172
  is_merge=0
173
173
  [ "$(git log -1 --format=%P "$sha" | wc -w | tr -d '[:space:]')" -ge 2 ] && is_merge=1
174
174