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
@@ -3,15 +3,29 @@
3
3
  # merge. They are CI-agnostic bash in checks/ — this workflow just invokes them with the PR base.
4
4
  # This workflow file is OWNED by yad-checks (the marker on line 1 identifies it). It runs
5
5
  # independently of any other workflow in .github/workflows/, so wiring never edits a foreign 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-checks
7
14
  on:
8
15
  pull_request:
9
- # `edited` (beyond the opened/synchronize/reopened defaults) so a PR title/body correction
10
- # re-runs the pattern gates without a close/reopen — e.g. fixing a body the pr-template gate held.
11
- # The commit-range jobs below skip a bare `edited` (only pr-title/pr-template need to re-check).
12
- types: [opened, synchronize, reopened, edited]
16
+ # Never `edited` (#425). A job skipped by `if:` counts as passed, so a run started by an edit of the PR
17
+ # text would show every gate here as passed on the same commit — a failed gate could turn green. The two
18
+ # checks that read the PR text, pr-title and pr-template, run from yad-pr-text.yml, which does start on
19
+ # an edit.
20
+ types: [opened, synchronize, reopened]
13
21
  branches: ["**"]
14
22
 
23
+ # A newer push to the same pull request cancels this workflow's older run (#428): only the newest commit
24
+ # can be merged, and every gate here re-reads the whole PR range, so the older run checks nothing it misses.
25
+ concurrency:
26
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
27
+ cancel-in-progress: true
28
+
15
29
  # Read-only by default: no gate here writes to the repo. A job that needs more asks for it itself.
16
30
  permissions:
17
31
  contents: read
@@ -19,38 +33,134 @@ permissions:
19
33
  jobs:
20
34
  spec-link:
21
35
  runs-on: ubuntu-latest
22
- if: github.event.action != 'edited'
36
+ timeout-minutes: 10
23
37
  steps:
24
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
25
- with: { fetch-depth: 0 }
26
- - run: bash checks/spec-link.sh "origin/${{ github.base_ref }}"
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/spec-link.sh" "origin/${{ github.base_ref }}"
27
73
 
28
74
  contract-check:
29
75
  runs-on: ubuntu-latest
30
- if: github.event.action != 'edited'
76
+ timeout-minutes: 10
31
77
  steps:
32
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
33
- with: { fetch-depth: 0 }
78
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
79
+ with: { fetch-depth: 0, persist-credentials: false }
80
+ - name: Gate scripts from the base branch (#426)
81
+ env: { YAD_BASE: "${{ github.base_ref }}" }
82
+ run: |
83
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
84
+ (
85
+ set -euo pipefail
86
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
87
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
88
+ 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; }
89
+ t="$(git ls-tree "$b" checks)"
90
+ case "$t" in
91
+ "") on_base=0 ;;
92
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
93
+ *) 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 ;;
94
+ esac
95
+ git ls-tree -z HEAD checks/ > "$d/.pr"
96
+ n=0
97
+ while IFS= read -r -d '' e; do
98
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
99
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
100
+ case "$m" in
101
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
102
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
103
+ esac
104
+ n=$((n + 1))
105
+ 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
106
+ done < "$d/.pr"
107
+ rm -f "$d/.pr"
108
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
109
+ 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
110
+ )
111
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
34
112
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
35
113
  # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
36
- - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
114
+ - run: bash "$YAD_CHECKS/product-checkout.sh" "origin/${{ github.base_ref }}"
37
115
  env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
38
- - run: bash checks/contract-check.sh "origin/${{ github.base_ref }}"
116
+ - run: bash "$YAD_CHECKS/contract-check.sh" "origin/${{ github.base_ref }}"
39
117
 
40
118
  # E65/E66 — the risk map (.sdlc/risk-map: a risk level per directory, no names). Warnings, and the
41
119
  # approver count read from the base branch's map. The script always exits 0: the count is reported,
42
120
  # not enforced, and a stale map never blocks a merge.
43
121
  risk-map:
44
122
  runs-on: ubuntu-latest
45
- if: github.event.action != 'edited'
123
+ timeout-minutes: 10
46
124
  steps:
47
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
48
- with: { fetch-depth: 0 }
49
- - run: bash checks/risk-map-check.sh "origin/${{ github.base_ref }}"
125
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
126
+ with: { fetch-depth: 0, persist-credentials: false }
127
+ - name: Gate scripts from the base branch (#426)
128
+ env: { YAD_BASE: "${{ github.base_ref }}" }
129
+ run: |
130
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
131
+ (
132
+ set -euo pipefail
133
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
134
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
135
+ 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; }
136
+ t="$(git ls-tree "$b" checks)"
137
+ case "$t" in
138
+ "") on_base=0 ;;
139
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
140
+ *) 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 ;;
141
+ esac
142
+ git ls-tree -z HEAD checks/ > "$d/.pr"
143
+ n=0
144
+ while IFS= read -r -d '' e; do
145
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
146
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
147
+ case "$m" in
148
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
149
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
150
+ esac
151
+ n=$((n + 1))
152
+ 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
153
+ done < "$d/.pr"
154
+ rm -f "$d/.pr"
155
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
156
+ 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
157
+ )
158
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
159
+ - run: bash "$YAD_CHECKS/risk-map-check.sh" "origin/${{ github.base_ref }}"
50
160
 
51
161
  build-test-lint:
52
162
  runs-on: ubuntu-latest
53
- if: github.event.action != 'edited'
163
+ timeout-minutes: 30
54
164
  env:
55
165
  YAD_TEST_MAX_WORKERS: "2" # cap jest/vitest test workers in CI; ignored by other runners
56
166
  YAD_NODE_VERSION: ${{ vars.YAD_NODE_VERSION || '22' }} # repo variable; a current 22 or 24 line (Node 25+ has no Corepack; 18 and 20 are end of life)
@@ -58,20 +168,58 @@ jobs:
58
168
  NX_HEAD: ${{ github.event.pull_request.head.sha }}
59
169
  COREPACK_HOME: ${{ github.workspace }}/.corepack-cache # pinned-manager downloads, cached below
60
170
  steps:
61
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
171
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
62
172
  with:
63
173
  fetch-depth: 0
64
- filter: blob:none
65
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
174
+ # No `filter: blob:none` (#426): the next step reads the base's checks/, which a
175
+ # partial clone leaves out when the PR changed them, and with no credentials kept it
176
+ # could not fetch them.
177
+ persist-credentials: false
178
+ - name: Gate scripts from the base branch (#426)
179
+ env: { YAD_BASE: "${{ github.base_ref }}" }
180
+ run: |
181
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
182
+ (
183
+ set -euo pipefail
184
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
185
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
186
+ 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; }
187
+ t="$(git ls-tree "$b" checks)"
188
+ case "$t" in
189
+ "") on_base=0 ;;
190
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
191
+ *) 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 ;;
192
+ esac
193
+ git ls-tree -z HEAD checks/ > "$d/.pr"
194
+ n=0
195
+ while IFS= read -r -d '' e; do
196
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
197
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
198
+ case "$m" in
199
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
200
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
201
+ esac
202
+ n=$((n + 1))
203
+ 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
204
+ done < "$d/.pr"
205
+ rm -f "$d/.pr"
206
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
207
+ 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
208
+ )
209
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
210
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
66
211
  with:
67
212
  node-version: ${{ env.YAD_NODE_VERSION }}
213
+ # Off: setup-node v5+ caches npm by itself when package.json names a packageManager; the next step
214
+ # already caches npm, pnpm and Corepack, so a second cache would only cost time (#429).
215
+ package-manager-cache: false
68
216
  # Dependency cache for either manager: npm's ~/.npm, pnpm's content-addressable store, and the
69
217
  # Corepack home where `corepack prepare` keeps the pinned manager (otherwise re-downloaded from
70
218
  # the registry on every job, even when the dependency cache hits). Keyed on the lockfiles AND
71
219
  # package.json, since a packageManager bump changes no lockfile. setup-node's own `cache:` must
72
220
  # name the manager up front (and needs pnpm on PATH before it runs), which package.json only
73
221
  # decides later — so cache the directories directly.
74
- - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
222
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
75
223
  with:
76
224
  path: |
77
225
  ~/.npm
@@ -79,8 +227,8 @@ jobs:
79
227
  ${{ env.COREPACK_HOME }}
80
228
  key: yad-deps-${{ runner.os }}-node${{ env.YAD_NODE_VERSION }}-${{ hashFiles('package-lock.json', 'npm-shrinkwrap.json', 'pnpm-lock.yaml', 'package.json') }}
81
229
  restore-keys: yad-deps-${{ runner.os }}-node${{ env.YAD_NODE_VERSION }}-
82
- - run: bash checks/install-deps.sh
83
- - run: bash checks/build-test-lint.sh
230
+ - run: bash "$YAD_CHECKS/install-deps.sh"
231
+ - run: bash "$YAD_CHECKS/build-test-lint.sh"
84
232
 
85
233
  # Phase 6 — feature-thread gates. lineage-check: the change links a real threaded epic. epic-open:
86
234
  # a sealed epic (all stories shipped) refuses new behaviour, forcing a change-epic. reconcile-debt:
@@ -88,79 +236,219 @@ jobs:
88
236
  # story->epic resolution and degrade to a note when the product repo is not reachable from CI.
89
237
  lineage-check:
90
238
  runs-on: ubuntu-latest
91
- if: github.event.action != 'edited'
239
+ timeout-minutes: 10
92
240
  steps:
93
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
94
- with: { fetch-depth: 0 }
241
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
242
+ with: { fetch-depth: 0, persist-credentials: false }
243
+ - name: Gate scripts from the base branch (#426)
244
+ env: { YAD_BASE: "${{ github.base_ref }}" }
245
+ run: |
246
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
247
+ (
248
+ set -euo pipefail
249
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
250
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
251
+ 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; }
252
+ t="$(git ls-tree "$b" checks)"
253
+ case "$t" in
254
+ "") on_base=0 ;;
255
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
256
+ *) 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 ;;
257
+ esac
258
+ git ls-tree -z HEAD checks/ > "$d/.pr"
259
+ n=0
260
+ while IFS= read -r -d '' e; do
261
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
262
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
263
+ case "$m" in
264
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
265
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
266
+ esac
267
+ n=$((n + 1))
268
+ 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
269
+ done < "$d/.pr"
270
+ rm -f "$d/.pr"
271
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
272
+ 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
273
+ )
274
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
95
275
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
96
276
  # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
97
- - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
277
+ - run: bash "$YAD_CHECKS/product-checkout.sh" "origin/${{ github.base_ref }}"
98
278
  env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
99
- - run: bash checks/lineage-check.sh "origin/${{ github.base_ref }}"
279
+ - run: bash "$YAD_CHECKS/lineage-check.sh" "origin/${{ github.base_ref }}"
100
280
 
101
281
  epic-open:
102
282
  runs-on: ubuntu-latest
103
- if: github.event.action != 'edited'
283
+ timeout-minutes: 10
104
284
  steps:
105
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
106
- with: { fetch-depth: 0 }
285
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
286
+ with: { fetch-depth: 0, persist-credentials: false }
287
+ - name: Gate scripts from the base branch (#426)
288
+ env: { YAD_BASE: "${{ github.base_ref }}" }
289
+ run: |
290
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
291
+ (
292
+ set -euo pipefail
293
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
294
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
295
+ 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; }
296
+ t="$(git ls-tree "$b" checks)"
297
+ case "$t" in
298
+ "") on_base=0 ;;
299
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
300
+ *) 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 ;;
301
+ esac
302
+ git ls-tree -z HEAD checks/ > "$d/.pr"
303
+ n=0
304
+ while IFS= read -r -d '' e; do
305
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
306
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
307
+ case "$m" in
308
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
309
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
310
+ esac
311
+ n=$((n + 1))
312
+ 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
313
+ done < "$d/.pr"
314
+ rm -f "$d/.pr"
315
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
316
+ 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
317
+ )
318
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
107
319
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
108
320
  # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
109
- - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
321
+ - run: bash "$YAD_CHECKS/product-checkout.sh" "origin/${{ github.base_ref }}"
110
322
  env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
111
- - run: bash checks/epic-open.sh "origin/${{ github.base_ref }}"
323
+ - run: bash "$YAD_CHECKS/epic-open.sh" "origin/${{ github.base_ref }}"
112
324
 
113
325
  reconcile-debt:
114
326
  runs-on: ubuntu-latest
115
- if: github.event.action != 'edited'
327
+ timeout-minutes: 10
116
328
  steps:
117
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
118
- with: { fetch-depth: 0 }
329
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
330
+ with: { fetch-depth: 0, persist-credentials: false }
331
+ - name: Gate scripts from the base branch (#426)
332
+ env: { YAD_BASE: "${{ github.base_ref }}" }
333
+ run: |
334
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
335
+ (
336
+ set -euo pipefail
337
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
338
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
339
+ 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; }
340
+ t="$(git ls-tree "$b" checks)"
341
+ case "$t" in
342
+ "") on_base=0 ;;
343
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
344
+ *) 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 ;;
345
+ esac
346
+ git ls-tree -z HEAD checks/ > "$d/.pr"
347
+ n=0
348
+ while IFS= read -r -d '' e; do
349
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
350
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
351
+ case "$m" in
352
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
353
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
354
+ esac
355
+ n=$((n + 1))
356
+ 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
357
+ done < "$d/.pr"
358
+ rm -f "$d/.pr"
359
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
360
+ 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
361
+ )
362
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
119
363
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
120
364
  # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
121
- - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
365
+ - run: bash "$YAD_CHECKS/product-checkout.sh" "origin/${{ github.base_ref }}"
122
366
  env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
123
- - run: bash checks/reconcile-debt-check.sh "origin/${{ github.base_ref }}"
367
+ - run: bash "$YAD_CHECKS/reconcile-debt-check.sh" "origin/${{ github.base_ref }}"
124
368
 
125
- # Pattern gates: commit subject + PR title + PR body all follow the convention (profile: code).
126
- # commit-message reads the commit range, not the title/body — skip it on a bare `edited` event.
369
+ # Pattern gate: every commit subject follows the convention (profile: code). The PR title and body are
370
+ # checked by yad-pr-text.yml.
127
371
  commit-message:
128
372
  runs-on: ubuntu-latest
129
- if: github.event.action != 'edited'
130
- steps:
131
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
132
- with: { fetch-depth: 0 }
133
- - run: bash checks/commit-message.sh --profile code "origin/${{ github.base_ref }}"
134
-
135
- # Pass the title via env (never interpolate untrusted ${{ }} into a run line — injection-safe).
136
- pr-title:
137
- runs-on: ubuntu-latest
138
- env:
139
- PR_TITLE: ${{ github.event.pull_request.title }}
140
- steps:
141
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
142
- - run: bash checks/pr-title.sh --profile code "$PR_TITLE"
143
-
144
- pr-template:
145
- runs-on: ubuntu-latest
146
- env:
147
- PR_BODY: ${{ github.event.pull_request.body }}
373
+ timeout-minutes: 10
148
374
  steps:
149
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
150
- - run: |
151
- body="$(mktemp)"; printf '%s' "$PR_BODY" > "$body"
152
- bash checks/pr-template.sh --profile code "$body"
375
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
376
+ with: { fetch-depth: 0, persist-credentials: false }
377
+ - name: Gate scripts from the base branch (#426)
378
+ env: { YAD_BASE: "${{ github.base_ref }}" }
379
+ run: |
380
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
381
+ (
382
+ set -euo pipefail
383
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
384
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
385
+ 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; }
386
+ t="$(git ls-tree "$b" checks)"
387
+ case "$t" in
388
+ "") on_base=0 ;;
389
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
390
+ *) 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 ;;
391
+ esac
392
+ git ls-tree -z HEAD checks/ > "$d/.pr"
393
+ n=0
394
+ while IFS= read -r -d '' e; do
395
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
396
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
397
+ case "$m" in
398
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
399
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
400
+ esac
401
+ n=$((n + 1))
402
+ 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
403
+ done < "$d/.pr"
404
+ rm -f "$d/.pr"
405
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
406
+ 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
407
+ )
408
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
409
+ - run: bash "$YAD_CHECKS/commit-message.sh" --profile code "origin/${{ github.base_ref }}"
153
410
 
154
411
  # No unverified commits: a platform-Verified signature on every commit (write access decides who authors).
155
- # Reads the commit range, not the title/body — skip it on a bare `edited` event.
156
412
  verified-commits:
157
413
  runs-on: ubuntu-latest
158
- if: github.event.action != 'edited'
414
+ timeout-minutes: 10
159
415
  permissions:
160
416
  contents: read
161
417
  env:
162
418
  GH_TOKEN: ${{ github.token }} # read-only: gh api commits/<sha> for the Verified badge
163
419
  steps:
164
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
165
- with: { fetch-depth: 0 }
166
- - run: bash checks/verified-commits.sh "origin/${{ github.base_ref }}"
420
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
421
+ with: { fetch-depth: 0, persist-credentials: false }
422
+ - name: Gate scripts from the base branch (#426)
423
+ env: { YAD_BASE: "${{ github.base_ref }}" }
424
+ run: |
425
+ YAD_CHECKS="$RUNNER_TEMP/yad-base-checks/checks"
426
+ (
427
+ set -euo pipefail
428
+ b="origin/${YAD_BASE}"; d="${YAD_CHECKS%/checks}"
429
+ rm -rf "$d"; mkdir -p "$YAD_CHECKS"
430
+ 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; }
431
+ t="$(git ls-tree "$b" checks)"
432
+ case "$t" in
433
+ "") on_base=0 ;;
434
+ "040000 tree "*) git archive "$b" checks | tar -x -C "$d"; on_base=1 ;;
435
+ *) 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 ;;
436
+ esac
437
+ git ls-tree -z HEAD checks/ > "$d/.pr"
438
+ n=0
439
+ while IFS= read -r -d '' e; do
440
+ m="${e%% *}"; p="${e#*$'\t'}"; o="${e#* * }"; o="${o%%$'\t'*}"; s="${p//[[:cntrl:]]/?}"
441
+ if [ -e "$d/$p" ] || [ -L "$d/$p" ]; then continue; fi
442
+ case "$m" in
443
+ 100644 | 100755) git cat-file blob "$o" > "$d/$p"; if [ "$m" = 100755 ]; then chmod +x "$d/$p"; fi ;;
444
+ *) printf 'note: %s in this PR is not a plain file, so it is not run (#426)\n' "$s"; continue ;;
445
+ esac
446
+ n=$((n + 1))
447
+ 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
448
+ done < "$d/.pr"
449
+ rm -f "$d/.pr"
450
+ if [ "$n" = 1 ]; then w="1 file"; else w="$n files"; fi
451
+ 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
452
+ )
453
+ echo "YAD_CHECKS=$YAD_CHECKS" >> "$GITHUB_ENV"
454
+ - run: bash "$YAD_CHECKS/verified-commits.sh" "origin/${{ github.base_ref }}"