yadflow 4.9.0 → 4.11.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 (155) hide show
  1. package/CHANGELOG.md +184 -0
  2. package/README.md +15 -5
  3. package/bin/commands.mjs +11 -1
  4. package/bin/yad.mjs +203 -14
  5. package/cli/agent-guard-worker.mjs +13 -0
  6. package/cli/agent-guard.mjs +1797 -73
  7. package/cli/agent-rules.mjs +64 -5
  8. package/cli/argv-flags.mjs +2 -2
  9. package/cli/brain/vendor/LICENSE-graphology-library.txt +21 -0
  10. package/cli/brain/vendor/LICENSE-graphology.txt +21 -0
  11. package/cli/brain/vendor/LICENSE-sigma.txt +12 -0
  12. package/cli/brain/vendor/graphology-library.min.js +2 -0
  13. package/cli/brain/vendor/graphology.umd.min.js +2 -0
  14. package/cli/brain/vendor/sigma.min.js +1369 -0
  15. package/cli/brain/view/app.js +382 -0
  16. package/cli/brain/view/index.html +63 -0
  17. package/cli/brain/view/live.css +228 -0
  18. package/cli/brain/view/live.html +110 -0
  19. package/cli/brain/view/live.js +884 -0
  20. package/cli/brain/view/style.css +141 -0
  21. package/cli/brain-about.mjs +206 -0
  22. package/cli/brain-activity.mjs +285 -0
  23. package/cli/brain-skills.mjs +118 -0
  24. package/cli/brain-vendor.mjs +71 -0
  25. package/cli/brain-view.mjs +344 -0
  26. package/cli/brain.mjs +810 -0
  27. package/cli/ci-check.mjs +48 -4
  28. package/cli/codeowners-command.mjs +72 -6
  29. package/cli/commit.mjs +17 -3
  30. package/cli/docs.mjs +2 -0
  31. package/cli/doctor.mjs +151 -25
  32. package/cli/epic-state.mjs +186 -4
  33. package/cli/epic.mjs +26 -10
  34. package/cli/errors.mjs +2 -1
  35. package/cli/find-product.mjs +69 -15
  36. package/cli/fold.mjs +31 -6
  37. package/cli/foundation-publish.mjs +256 -0
  38. package/cli/gate.mjs +29 -3
  39. package/cli/git-read.mjs +38 -0
  40. package/cli/guard-stream.mjs +409 -0
  41. package/cli/guide.mjs +3 -1
  42. package/cli/hook.mjs +102 -9
  43. package/cli/issue-links.mjs +61 -0
  44. package/cli/issues-act.mjs +371 -0
  45. package/cli/issues-write.mjs +441 -0
  46. package/cli/issues.mjs +513 -0
  47. package/cli/lib.mjs +37 -2
  48. package/cli/lifecycle.mjs +7 -0
  49. package/cli/local-page.mjs +138 -0
  50. package/cli/machine.mjs +1 -1
  51. package/cli/manifest.mjs +59 -3
  52. package/cli/map/view/app.js +712 -0
  53. package/cli/map/view/index.html +50 -0
  54. package/cli/map/view/style.css +142 -0
  55. package/cli/map-view.mjs +186 -0
  56. package/cli/map.mjs +637 -0
  57. package/cli/members.mjs +9 -15
  58. package/cli/next.mjs +1 -1
  59. package/cli/openpr.mjs +26 -6
  60. package/cli/plan.mjs +127 -0
  61. package/cli/platform.mjs +159 -4
  62. package/cli/product-index.mjs +1 -1
  63. package/cli/protection.mjs +53 -3
  64. package/cli/reconcile.mjs +9 -3
  65. package/cli/report.mjs +9 -3
  66. package/cli/reports-dir.mjs +391 -0
  67. package/cli/reports.mjs +65 -0
  68. package/cli/run-checks.mjs +15 -4
  69. package/cli/scan.mjs +314 -0
  70. package/cli/setup.mjs +42 -8
  71. package/cli/standup.mjs +120 -78
  72. package/cli/status.mjs +6 -5
  73. package/cli/story-frames.mjs +17 -6
  74. package/cli/test-agents-file.mjs +985 -12
  75. package/cli/test-brain-activity.mjs +753 -0
  76. package/cli/test-brain-view.mjs +381 -0
  77. package/cli/test-brain.mjs +795 -0
  78. package/cli/test-build.mjs +25 -0
  79. package/cli/test-ci-check.mjs +469 -10
  80. package/cli/test-guide.mjs +218 -0
  81. package/cli/test-machine.mjs +59 -0
  82. package/cli/test-map.mjs +615 -0
  83. package/cli/test-node.mjs +15 -0
  84. package/cli/test-reports.mjs +382 -0
  85. package/cli/test-run-checks.mjs +21 -0
  86. package/cli/test-setup-agent.mjs +14 -0
  87. package/cli/test-story-frames.mjs +74 -4
  88. package/cli/test-worktree.mjs +24 -3
  89. package/cli/toolbox-connect.mjs +259 -0
  90. package/cli/toolbox.mjs +187 -12
  91. package/cli/update-commit.mjs +101 -9
  92. package/cli/usage.mjs +8 -4
  93. package/package.json +12 -4
  94. package/skills/sdlc/config.yaml +1 -1
  95. package/skills/sdlc/module-help.csv +3 -1
  96. package/skills/yad-analysis/SKILL.md +4 -0
  97. package/skills/yad-architecture/SKILL.md +22 -4
  98. package/skills/yad-backfill/SKILL.md +4 -0
  99. package/skills/yad-change/SKILL.md +7 -1
  100. package/skills/yad-change/references/triage.md +2 -0
  101. package/skills/yad-checks/SKILL.md +15 -7
  102. package/skills/yad-checks/references/check-gates.md +70 -35
  103. package/skills/yad-checks/templates/checks/build-test-lint.sh +7 -0
  104. package/skills/yad-checks/templates/checks/install-deps.sh +6 -0
  105. package/skills/yad-checks/templates/checks/member-check.mjs +3 -2
  106. package/skills/yad-checks/templates/checks/package-manager.sh +42 -0
  107. package/skills/yad-checks/templates/checks/risk-map-check.sh +2 -2
  108. package/skills/yad-checks/templates/checks/verified-commits.sh +3 -3
  109. package/skills/yad-checks/templates/github/yad-checks.yml +358 -69
  110. package/skills/yad-checks/templates/github/yad-pr-text.yml +118 -0
  111. package/skills/yad-checks/templates/github/yad-product-checks.yml +130 -54
  112. package/skills/yad-checks/templates/github/yad-product-pr-text.yml +131 -0
  113. package/skills/yad-checks/templates/github/yad-update-guard.yml +2 -1
  114. package/skills/yad-checks/templates/github/yad-verified-commits.yml +49 -3
  115. package/skills/yad-checks/templates/gitlab/yad-checks.gitlab-ci.yml +80 -20
  116. package/skills/yad-checks/templates/gitlab/yad-product-checks.gitlab-ci.yml +59 -9
  117. package/skills/yad-checks/templates/gitlab/yad-update-guard.gitlab-ci.yml +1 -0
  118. package/skills/yad-checks/templates/gitlab/yad-verified-commits.gitlab-ci.yml +49 -1
  119. package/skills/yad-checks/templates/hooks/agent-guard.mjs +44 -10
  120. package/skills/yad-checks/templates/hooks/ledger-guard-cursor.mjs +12 -6
  121. package/skills/yad-checks/templates/hooks/yad-activity.mjs +238 -0
  122. package/skills/yad-commit/SKILL.md +3 -1
  123. package/skills/yad-connect-design/SKILL.md +42 -10
  124. package/skills/yad-connect-design/references/design-context.md +35 -5
  125. package/skills/yad-connect-design/references/design-registry.md +3 -3
  126. package/skills/yad-connect-learning/SKILL.md +12 -2
  127. package/skills/yad-connect-repos/SKILL.md +18 -0
  128. package/skills/yad-connect-testing/SKILL.md +22 -5
  129. package/skills/yad-connect-testing/references/testing-context.md +1 -1
  130. package/skills/yad-discovery/SKILL.md +11 -0
  131. package/skills/yad-discovery/references/foundation-schema.md +11 -0
  132. package/skills/yad-docs/templates/app/package-lock.json +18 -10
  133. package/skills/yad-docs/templates/app/package.json +6 -1
  134. package/skills/yad-epic/SKILL.md +7 -0
  135. package/skills/yad-epic/references/state-schema.md +50 -1
  136. package/skills/yad-guide/SKILL.md +8 -4
  137. package/skills/yad-implement/SKILL.md +117 -4
  138. package/skills/yad-implement/references/implement-conventions.md +2 -1
  139. package/skills/yad-issues/SKILL.md +54 -0
  140. package/skills/yad-learn/SKILL.md +4 -0
  141. package/skills/yad-open-pr/SKILL.md +6 -0
  142. package/skills/yad-pr-template/SKILL.md +2 -1
  143. package/skills/yad-pr-template/templates/checks/pr-template.sh +8 -4
  144. package/skills/yad-pr-template/templates/checks/pr-title.sh +42 -6
  145. package/skills/yad-product-bridge/references/bridge.md +28 -0
  146. package/skills/yad-product-bridge/templates/github/yad-gate-sync.yml +25 -11
  147. package/skills/yad-product-bridge/templates/gitlab/yad-gate-sync.gitlab-ci.yml +38 -14
  148. package/skills/yad-run/SKILL.md +5 -0
  149. package/skills/yad-scan/SKILL.md +51 -0
  150. package/skills/yad-spec/SKILL.md +32 -2
  151. package/skills/yad-stories/SKILL.md +22 -4
  152. package/skills/yad-stories/references/story-schema.md +1 -1
  153. package/skills/yad-test-cases/SKILL.md +18 -2
  154. package/skills/yad-ui/SKILL.md +43 -8
  155. package/skills/yad-checks/templates/gitlab/.gitlab-ci.yml +0 -49
@@ -0,0 +1,118 @@
1
+ # yad-managed: yad-checks
2
+ # SDLC pattern gates on the PR text (profile: code): the PR title and the PR body follow the convention.
3
+ # Its own workflow (#425) so that an edit of the title or body re-runs these two checks and nothing else.
4
+ # A gate job skipped by `if:` counts as passed, so a run of yad-checks started by an edit would turn a
5
+ # failed gate green. This file is OWNED by yad-checks (the marker on line 1 identifies it).
6
+ #
7
+ # Gate scripts (#426): every job runs the BASE branch's copy of checks/, never the PR's own, so a PR that
8
+ # changes a gate script is still judged by the script already merged. A script the base does not have yet
9
+ # (the PR that first installs the gates, or a `yad update` that adds one) runs from the PR, with a note.
10
+ # The base's script runs with THIS file's call: keep every call one the previous release's script accepts.
11
+ # This file itself still comes from the PR: protect checks/ and the CI files with a CODEOWNERS rule and
12
+ # a required Code Owner review (docs/branch-protection.md, "Who may change the gates").
13
+ name: yad-pr-text
14
+ on:
15
+ pull_request:
16
+ # `edited` (beyond the opened/synchronize/reopened defaults) so a PR title/body correction
17
+ # re-runs these checks without a close/reopen — e.g. fixing a body the pr-template gate held.
18
+ types: [opened, synchronize, reopened, edited]
19
+ branches: ["**"]
20
+
21
+ # A newer edit of the PR text cancels this workflow's older run on the same commit (#428): both checks read the
22
+ # PR's current title and body, so the newest run is the one that counts. The group names the commit too, so a
23
+ # late-delivered edit of an older commit can never cancel the run a newer push started.
24
+ concurrency:
25
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
26
+ cancel-in-progress: true
27
+
28
+ # Read-only: no check here writes to the repo.
29
+ permissions:
30
+ contents: read
31
+
32
+ jobs:
33
+ # Pass the title via env (never interpolate untrusted ${{ }} into a run line — injection-safe).
34
+ pr-title:
35
+ runs-on: ubuntu-latest
36
+ timeout-minutes: 10
37
+ env:
38
+ PR_TITLE: ${{ github.event.pull_request.title }}
39
+ steps:
40
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41
+ with: { fetch-depth: 0, persist-credentials: false }
42
+ - name: Gate scripts from the base branch (#426)
43
+ env: { YAD_BASE: "${{ github.base_ref }}" }
44
+ run: |
45
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
46
+ (
47
+ set -euo pipefail
48
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
49
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
50
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
51
+ t="$(git ls-tree "$b" checks)"
52
+ case "$t" in
53
+ "") on_base=0 ;;
54
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
55
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
56
+ esac
57
+ git ls-tree -z HEAD checks/ > "$d/.pr"
58
+ n=0
59
+ while IFS= read -r -d '' e; do
60
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
61
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
62
+ case "$m" in
63
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
64
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
65
+ esac
66
+ n=$((n + 1))
67
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
68
+ done < "$d/.pr"
69
+ rm -f "$d/.pr"
70
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
71
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
72
+ )
73
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
74
+ - run: bash "$YAD_CHECKS/pr-title.sh" --profile code "$PR_TITLE"
75
+
76
+ pr-template:
77
+ runs-on: ubuntu-latest
78
+ timeout-minutes: 10
79
+ env:
80
+ PR_BODY: ${{ github.event.pull_request.body }}
81
+ steps:
82
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
83
+ with: { fetch-depth: 0, persist-credentials: false }
84
+ - name: Gate scripts from the base branch (#426)
85
+ env: { YAD_BASE: "${{ github.base_ref }}" }
86
+ run: |
87
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
88
+ (
89
+ set -euo pipefail
90
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
91
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
92
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
93
+ t="$(git ls-tree "$b" checks)"
94
+ case "$t" in
95
+ "") on_base=0 ;;
96
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
97
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
98
+ esac
99
+ git ls-tree -z HEAD checks/ > "$d/.pr"
100
+ n=0
101
+ while IFS= read -r -d '' e; do
102
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
103
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
104
+ case "$m" in
105
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
106
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
107
+ esac
108
+ n=$((n + 1))
109
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
110
+ done < "$d/.pr"
111
+ rm -f "$d/.pr"
112
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
113
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
114
+ )
115
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
116
+ - run: |
117
+ body="$(mktemp)"; printf '%s' "$PR_BODY" > "$body"
118
+ bash "$YAD_CHECKS/pr-template.sh" --profile code "$body"
@@ -1,86 +1,162 @@
1
1
  # yad-managed: yad-checks
2
- # Pattern gates for the PRODUCT. They run with `--profile product` and split by head branch:
3
- # review/EP-* PRs are Shape artifact-review vehicles — a `review: <artifact> (EP-<slug>)` title
4
- # and the Product artifact-review template body.
5
- # every other PR is a tooling/code change to the Product itself — a Conventional-Commits title and the
6
- # code task template body (same convention the code repos use).
7
- # The head ref is passed via --head so the gate can tell the two apart. Commit subjects are always
8
- # Conventional-Commits. Standalone workflow so it never collides with the code-repo yad-checks workflow.
2
+ # Gates for the PRODUCT's PRs: commit subjects (Conventional Commits, `--profile product`), the CI-owned
3
+ # gate ledger, and member files. The PR title and body are checked by yad-product-pr-text.yml (#425).
4
+ # Standalone workflow so it never collides with the code-repo yad-checks workflow.
5
+ #
6
+ # Gate scripts (#426): every job runs the BASE branch's copy of checks/, never the PR's own, so a PR that
7
+ # changes a gate script is still judged by the script already merged. A script the base does not have yet
8
+ # (the PR that first installs the gates, or a `yad update` that adds one) runs from the PR, with a note.
9
+ # The base's script runs with THIS file's call: keep every call one the previous release's script accepts.
10
+ # This file itself still comes from the PR: protect checks/ and the CI files with a CODEOWNERS rule and
11
+ # a required Code Owner review (docs/branch-protection.md, "Who may change the gates").
9
12
  name: yad-product-checks
10
13
  on:
11
14
  pull_request:
12
- # `edited` (beyond the opened/synchronize/reopened defaults) so a PR title/body correction
13
- # re-runs the pattern gates without a close/reopen — e.g. fixing a body the pr-template gate held.
14
- types: [opened, synchronize, reopened, edited]
15
+ # Never `edited` (#425). A job skipped by `if:` counts as passed, so a run started by an edit of the PR
16
+ # text would show every gate here as passed on the same commit — a failed gate could turn green. The two
17
+ # checks that read the PR text, pr-title and pr-template, run from yad-product-pr-text.yml, which does
18
+ # start on an edit.
19
+ types: [opened, synchronize, reopened]
15
20
  branches: ["**"]
16
21
 
22
+ # A newer push to the same pull request cancels this workflow's older run (#428): only the newest commit
23
+ # can be merged, and every gate here re-reads the whole PR range, so the older run checks nothing it misses.
24
+ concurrency:
25
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
26
+ cancel-in-progress: true
27
+
17
28
  # Read-only by default: no gate here writes to the repo. A job that needs more asks for it itself.
18
29
  permissions:
19
30
  contents: read
20
31
 
21
32
  jobs:
22
- # commit-message + ledger-guard read the commit range, not the PR title/body — skip them on a bare
23
- # `edited` event (only pr-title/pr-template need to re-check a title/body fix).
33
+ # commit-message reads the commit range. The PR title and body are checked by yad-product-pr-text.yml.
24
34
  commit-message:
25
35
  runs-on: ubuntu-latest
26
- if: github.event.action != 'edited'
27
- steps:
28
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
29
- with: { fetch-depth: 0 }
30
- - run: bash checks/commit-message.sh --profile product "origin/${{ github.base_ref }}"
31
-
32
- # Pass the title via env (never interpolate untrusted ${{ }} into a run line — injection-safe).
33
- # fetch-depth: 0 + the base ref give us the PR's changed paths, so the gate can reject an artifact
34
- # change (epics/**) riding a non-review head past the Shape review with a plain code title.
35
- pr-title:
36
- runs-on: ubuntu-latest
37
- env:
38
- PR_TITLE: ${{ github.event.pull_request.title }}
39
- PR_HEAD: ${{ github.event.pull_request.head.ref }}
40
- BASE_REF: ${{ github.base_ref }}
41
- steps:
42
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
43
- with: { fetch-depth: 0 }
44
- - run: |
45
- changed="$(mktemp)"; git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...HEAD" > "$changed"
46
- bash checks/pr-title.sh --profile product --head "$PR_HEAD" --changed "$changed" "$PR_TITLE"
47
-
48
- pr-template:
49
- runs-on: ubuntu-latest
50
- env:
51
- PR_BODY: ${{ github.event.pull_request.body }}
52
- PR_HEAD: ${{ github.event.pull_request.head.ref }}
53
- BASE_REF: ${{ github.base_ref }}
36
+ timeout-minutes: 10
54
37
  steps:
55
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
56
- with: { fetch-depth: 0 }
57
- - run: |
58
- changed="$(mktemp)"; git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...HEAD" > "$changed"
59
- body="$(mktemp)"; printf '%s' "$PR_BODY" > "$body"
60
- bash checks/pr-template.sh --profile product --head "$PR_HEAD" --changed "$changed" "$body"
38
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
39
+ with: { fetch-depth: 0, persist-credentials: false }
40
+ - name: Gate scripts from the base branch (#426)
41
+ env: { YAD_BASE: "${{ github.base_ref }}" }
42
+ run: |
43
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
44
+ (
45
+ set -euo pipefail
46
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
47
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
48
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
49
+ t="$(git ls-tree "$b" checks)"
50
+ case "$t" in
51
+ "") on_base=0 ;;
52
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
53
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
54
+ esac
55
+ git ls-tree -z HEAD checks/ > "$d/.pr"
56
+ n=0
57
+ while IFS= read -r -d '' e; do
58
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
59
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
60
+ case "$m" in
61
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
62
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
63
+ esac
64
+ n=$((n + 1))
65
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
66
+ done < "$d/.pr"
67
+ rm -f "$d/.pr"
68
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
69
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
70
+ )
71
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
72
+ - run: bash "$YAD_CHECKS/commit-message.sh" --profile product "origin/${{ github.base_ref }}"
61
73
 
62
74
  # The gate ledger is CI-owned: reject non-bot commits to .sdlc/{state,approvals,comments,product-prs,hub-prs}.json
63
75
  # or reviews/*.md (.sdlc/contract-lock.json is artifact-side and allowed). The one other exception is a
64
76
  # brand-new epic's seed, which no CI path can write, so it rides this first review PR (#162).
65
77
  ledger-guard:
66
78
  runs-on: ubuntu-latest
67
- if: github.event.action != 'edited'
79
+ timeout-minutes: 10
68
80
  steps:
69
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
70
- with: { fetch-depth: 0 }
71
- - run: bash checks/ledger-guard.sh "origin/${{ github.base_ref }}"
81
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
82
+ with: { fetch-depth: 0, persist-credentials: false }
83
+ - name: Gate scripts from the base branch (#426)
84
+ env: { YAD_BASE: "${{ github.base_ref }}" }
85
+ run: |
86
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
87
+ (
88
+ set -euo pipefail
89
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
90
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
91
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
92
+ t="$(git ls-tree "$b" checks)"
93
+ case "$t" in
94
+ "") on_base=0 ;;
95
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
96
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
97
+ esac
98
+ git ls-tree -z HEAD checks/ > "$d/.pr"
99
+ n=0
100
+ while IFS= read -r -d '' e; do
101
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
102
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
103
+ case "$m" in
104
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
105
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
106
+ esac
107
+ n=$((n + 1))
108
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
109
+ done < "$d/.pr"
110
+ rm -f "$d/.pr"
111
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
112
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
113
+ )
114
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
115
+ - run: bash "$YAD_CHECKS/ledger-guard.sh" "origin/${{ github.base_ref }}"
72
116
 
73
117
  # E131: a member file (.sdlc/members/) is changed only by its own person, and every email it adds must be
74
118
  # the author of a commit in this PR that GitHub attributes to that person. Needs a read token to ask
75
119
  # GitHub who a commit belongs to; the PR author comes from the event, never from the PR's own files.
76
120
  member-check:
77
121
  runs-on: ubuntu-latest
78
- if: github.event.action != 'edited'
122
+ timeout-minutes: 10
79
123
  env:
80
124
  PR_AUTHOR: ${{ github.event.pull_request.user.login }}
81
125
  PR_AUTHOR_ID: ${{ github.event.pull_request.user.id }}
82
126
  GH_TOKEN: ${{ github.token }}
83
127
  steps:
84
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
85
- with: { fetch-depth: 0 }
86
- - run: node checks/member-check.mjs "origin/${{ github.base_ref }}"
128
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
129
+ with: { fetch-depth: 0, persist-credentials: false }
130
+ - name: Gate scripts from the base branch (#426)
131
+ env: { YAD_BASE: "${{ github.base_ref }}" }
132
+ run: |
133
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
134
+ (
135
+ set -euo pipefail
136
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
137
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
138
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
139
+ t="$(git ls-tree "$b" checks)"
140
+ case "$t" in
141
+ "") on_base=0 ;;
142
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
143
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
144
+ esac
145
+ git ls-tree -z HEAD checks/ > "$d/.pr"
146
+ n=0
147
+ while IFS= read -r -d '' e; do
148
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
149
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
150
+ case "$m" in
151
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
152
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
153
+ esac
154
+ n=$((n + 1))
155
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
156
+ done < "$d/.pr"
157
+ rm -f "$d/.pr"
158
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
159
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
160
+ )
161
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
162
+ - run: node "$YAD_CHECKS/member-check.mjs" "origin/${{ github.base_ref }}"
@@ -0,0 +1,131 @@
1
+ # yad-managed: yad-checks
2
+ # Pattern gates on the PRODUCT's PR text, with `--profile product`, split by head branch:
3
+ # review/EP-* PRs are Shape artifact-review vehicles — a `review: <artifact> (EP-<slug>)` title
4
+ # and the Product artifact-review template body.
5
+ # every other PR is a tooling/code change to the Product itself — a Conventional-Commits title and the
6
+ # code task template body (same convention the code repos use).
7
+ # Its own workflow (#425) so that an edit of the title or body re-runs these two checks and nothing else.
8
+ # A gate job skipped by `if:` counts as passed, so a run of yad-product-checks started by an edit would
9
+ # turn a failed gate green.
10
+ #
11
+ # Gate scripts (#426): every job runs the BASE branch's copy of checks/, never the PR's own, so a PR that
12
+ # changes a gate script is still judged by the script already merged. A script the base does not have yet
13
+ # (the PR that first installs the gates, or a `yad update` that adds one) runs from the PR, with a note.
14
+ # The base's script runs with THIS file's call: keep every call one the previous release's script accepts.
15
+ # This file itself still comes from the PR: protect checks/ and the CI files with a CODEOWNERS rule and
16
+ # a required Code Owner review (docs/branch-protection.md, "Who may change the gates").
17
+ name: yad-product-pr-text
18
+ on:
19
+ pull_request:
20
+ # `edited` (beyond the opened/synchronize/reopened defaults) so a PR title/body correction
21
+ # re-runs these checks without a close/reopen — e.g. fixing a body the pr-template gate held.
22
+ types: [opened, synchronize, reopened, edited]
23
+ branches: ["**"]
24
+
25
+ # A newer edit of the PR text cancels this workflow's older run on the same commit (#428): both checks read the
26
+ # PR's current title and body, so the newest run is the one that counts. The group names the commit too, so a
27
+ # late-delivered edit of an older commit can never cancel the run a newer push started.
28
+ concurrency:
29
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
30
+ cancel-in-progress: true
31
+
32
+ # Read-only: no check here writes to the repo.
33
+ permissions:
34
+ contents: read
35
+
36
+ jobs:
37
+ # Pass the title via env (never interpolate untrusted ${{ }} into a run line — injection-safe).
38
+ # fetch-depth: 0 + the base ref give us the PR's changed paths, so the gate can reject an artifact
39
+ # change (epics/**) riding a non-review head past the Shape review with a plain code title.
40
+ pr-title:
41
+ runs-on: ubuntu-latest
42
+ timeout-minutes: 10
43
+ env:
44
+ PR_TITLE: ${{ github.event.pull_request.title }}
45
+ PR_HEAD: ${{ github.event.pull_request.head.ref }}
46
+ BASE_REF: ${{ github.base_ref }}
47
+ steps:
48
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
49
+ with: { fetch-depth: 0, persist-credentials: false }
50
+ - name: Gate scripts from the base branch (#426)
51
+ env: { YAD_BASE: "${{ github.base_ref }}" }
52
+ run: |
53
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
54
+ (
55
+ set -euo pipefail
56
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
57
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
58
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
59
+ t="$(git ls-tree "$b" checks)"
60
+ case "$t" in
61
+ "") on_base=0 ;;
62
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
63
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
64
+ esac
65
+ git ls-tree -z HEAD checks/ > "$d/.pr"
66
+ n=0
67
+ while IFS= read -r -d '' e; do
68
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
69
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
70
+ case "$m" in
71
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
72
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
73
+ esac
74
+ n=$((n + 1))
75
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
76
+ done < "$d/.pr"
77
+ rm -f "$d/.pr"
78
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
79
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
80
+ )
81
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
82
+ - run: |
83
+ changed="$(mktemp)"; git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...HEAD" > "$changed"
84
+ bash "$YAD_CHECKS/pr-title.sh" --profile product --head "$PR_HEAD" --changed "$changed" "$PR_TITLE"
85
+
86
+ pr-template:
87
+ runs-on: ubuntu-latest
88
+ timeout-minutes: 10
89
+ env:
90
+ PR_BODY: ${{ github.event.pull_request.body }}
91
+ PR_HEAD: ${{ github.event.pull_request.head.ref }}
92
+ BASE_REF: ${{ github.base_ref }}
93
+ steps:
94
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
95
+ with: { fetch-depth: 0, persist-credentials: false }
96
+ - name: Gate scripts from the base branch (#426)
97
+ env: { YAD_BASE: "${{ github.base_ref }}" }
98
+ run: |
99
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
100
+ (
101
+ set -euo pipefail
102
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
103
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
104
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
105
+ t="$(git ls-tree "$b" checks)"
106
+ case "$t" in
107
+ "") on_base=0 ;;
108
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
109
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
110
+ esac
111
+ git ls-tree -z HEAD checks/ > "$d/.pr"
112
+ n=0
113
+ while IFS= read -r -d '' e; do
114
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
115
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
116
+ case "$m" in
117
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
118
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
119
+ esac
120
+ n=$((n + 1))
121
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
122
+ done < "$d/.pr"
123
+ rm -f "$d/.pr"
124
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
125
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
126
+ )
127
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
128
+ - run: |
129
+ changed="$(mktemp)"; git -c core.quotePath=false diff --no-renames --name-only "origin/${BASE_REF}...HEAD" > "$changed"
130
+ body="$(mktemp)"; printf '%s' "$PR_BODY" > "$body"
131
+ bash "$YAD_CHECKS/pr-template.sh" --profile product --head "$PR_HEAD" --changed "$changed" "$body"
@@ -27,10 +27,11 @@ jobs:
27
27
  # Only the default branch — pushes to feature branches are reviewed via their PR gate suite.
28
28
  if: github.ref_name == github.event.repository.default_branch
29
29
  runs-on: ubuntu-latest
30
+ timeout-minutes: 10
30
31
  env:
31
32
  GH_TOKEN: ${{ github.token }} # read-only: gh api commits/<sha> for the Verified badge
32
33
  steps:
33
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
34
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34
35
  with: { fetch-depth: 0 }
35
36
  - name: Resolve the pushed range base
36
37
  id: base
@@ -3,20 +3,66 @@
3
3
  # must contain only commits whose signature the platform marks Verified. Who may author them is who has
4
4
  # write access to the repo — yadflow keeps no author list.
5
5
  # Standalone workflow so it never collides with the Product-flavored yad-checks workflow.
6
+ #
7
+ # Gate scripts (#426): every job runs the BASE branch's copy of checks/, never the PR's own, so a PR that
8
+ # changes a gate script is still judged by the script already merged. A script the base does not have yet
9
+ # (the PR that first installs the gates, or a `yad update` that adds one) runs from the PR, with a note.
10
+ # The base's script runs with THIS file's call: keep every call one the previous release's script accepts.
11
+ # This file itself still comes from the PR: protect checks/ and the CI files with a CODEOWNERS rule and
12
+ # a required Code Owner review (docs/branch-protection.md, "Who may change the gates").
6
13
  name: yad-verified-commits
7
14
  on:
8
15
  pull_request:
9
16
  branches: ["**"]
10
17
 
18
+ # A newer push to the same pull request cancels this workflow's older run (#428): only the newest commit
19
+ # can be merged, and every gate here re-reads the whole PR range, so the older run checks nothing it misses.
20
+ concurrency:
21
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
22
+ cancel-in-progress: true
23
+
11
24
  permissions:
12
25
  contents: read
13
26
 
14
27
  jobs:
15
28
  verified-commits:
16
29
  runs-on: ubuntu-latest
30
+ timeout-minutes: 10
17
31
  env:
18
32
  GH_TOKEN: ${{ github.token }} # read-only: gh api commits/<sha> for the Verified badge
19
33
  steps:
20
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
21
- with: { fetch-depth: 0 }
22
- - run: bash checks/verified-commits.sh "origin/${{ github.base_ref }}"
34
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35
+ with: { fetch-depth: 0, persist-credentials: false }
36
+ - name: Gate scripts from the base branch (#426)
37
+ env: { YAD_BASE: "${{ github.base_ref }}" }
38
+ run: |
39
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
40
+ (
41
+ set -euo pipefail
42
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
43
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
44
+ git rev-parse --verify --quiet "${b}^{commit}" > /dev/null || { echo "FAIL [base-checks]: ${b} is not in this checkout, so the gate scripts cannot be read from the base branch. Check the code out with its full history." >&2; exit 1; }
45
+ t="$(git ls-tree "$b" checks)"
46
+ case "$t" in
47
+ "") on_base=0 ;;
48
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
49
+ *) echo "FAIL [base-checks]: checks on ${b} is not a folder, so the gate scripts cannot be read from it. Make checks/ a plain folder on the base branch." >&2; exit 1 ;;
50
+ esac
51
+ git ls-tree -z HEAD checks/ > "$d/.pr"
52
+ n=0
53
+ while IFS= read -r -d '' e; do
54
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
55
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
56
+ case "$m" in
57
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
58
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
59
+ esac
60
+ n=$((n + 1))
61
+ if [ "$on_base" = 1 ]; then printf 'note: %s is not on %s yet, so the copy from this PR runs (#426)\n' "$s" "$YAD_BASE"; fi
62
+ done < "$d/.pr"
63
+ rm -f "$d/.pr"
64
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
65
+ if [ "$on_base" = 0 ]; then printf 'note: %s has no checks/ folder yet, so the gate scripts from this PR run: %s (#426)\n' "$YAD_BASE" "$w"; fi
66
+ )
67
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
68
+ - run: bash "$YAD_CHECKS/verified-commits.sh" "origin/${{ github.base_ref }}"