yadflow 4.5.2 → 4.7.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 (101) hide show
  1. package/CHANGELOG.md +206 -0
  2. package/README.md +4 -1
  3. package/bin/commands.mjs +5 -1
  4. package/bin/yad.mjs +174 -18
  5. package/cli/artifact-status.mjs +88 -20
  6. package/cli/build.mjs +1372 -0
  7. package/cli/checkpoint.mjs +2 -2
  8. package/cli/commit.mjs +1 -0
  9. package/cli/dial.mjs +21 -1
  10. package/cli/docs.mjs +6 -1
  11. package/cli/doctor.mjs +133 -26
  12. package/cli/epic-state.mjs +396 -123
  13. package/cli/errors.mjs +2 -0
  14. package/cli/find-product.mjs +36 -2
  15. package/cli/fold.mjs +9 -5
  16. package/cli/gate-local.mjs +9 -1
  17. package/cli/gate.mjs +442 -33
  18. package/cli/history.mjs +22 -2
  19. package/cli/hook.mjs +3 -1
  20. package/cli/index-command.mjs +2 -2
  21. package/cli/ledger.mjs +60 -0
  22. package/cli/lib.mjs +12 -1
  23. package/cli/lifecycle/defaults/1.json +96 -0
  24. package/cli/lifecycle/lifecycle.schema.json +121 -0
  25. package/cli/lifecycle.mjs +695 -0
  26. package/cli/next.mjs +34 -11
  27. package/cli/openpr.mjs +81 -5
  28. package/cli/platform.mjs +21 -0
  29. package/cli/pr-list.mjs +49 -3
  30. package/cli/product-index.mjs +6 -3
  31. package/cli/product-token.mjs +186 -0
  32. package/cli/productcommit.mjs +33 -0
  33. package/cli/recommend.mjs +3 -1
  34. package/cli/repo-publish.mjs +2 -2
  35. package/cli/run-checks.mjs +586 -0
  36. package/cli/ship-drift.mjs +384 -0
  37. package/cli/standup.mjs +1 -1
  38. package/cli/status.mjs +282 -0
  39. package/cli/test-build.mjs +1559 -0
  40. package/cli/test-run-checks.mjs +603 -0
  41. package/cli/test-worktree.mjs +520 -0
  42. package/cli/thread.mjs +50 -3
  43. package/cli/tidy.mjs +2 -2
  44. package/cli/toolbox.mjs +36 -5
  45. package/cli/workspace.mjs +4 -1
  46. package/cli/worktree-record.mjs +53 -0
  47. package/cli/worktree.mjs +379 -0
  48. package/package.json +4 -3
  49. package/skills/sdlc/config.yaml +28 -20
  50. package/skills/sdlc/module-help.csv +1 -1
  51. package/skills/yad-backfill/references/backfill.md +8 -1
  52. package/skills/yad-backfill/templates/checks/backfill-check.sh +54 -6
  53. package/skills/yad-change/SKILL.md +3 -0
  54. package/skills/yad-checks/SKILL.md +47 -5
  55. package/skills/yad-checks/references/check-gates.md +124 -12
  56. package/skills/yad-checks/templates/checks/build-test-lint.sh +22 -3
  57. package/skills/yad-checks/templates/checks/commit-message.sh +8 -2
  58. package/skills/yad-checks/templates/checks/contract-check.sh +354 -48
  59. package/skills/yad-checks/templates/checks/epic-open.sh +87 -14
  60. package/skills/yad-checks/templates/checks/ledger-guard.sh +3 -3
  61. package/skills/yad-checks/templates/checks/lineage-check.sh +88 -15
  62. package/skills/yad-checks/templates/checks/member-check.mjs +206 -35
  63. package/skills/yad-checks/templates/checks/package-manager.sh +41 -4
  64. package/skills/yad-checks/templates/checks/product-checkout.sh +161 -13
  65. package/skills/yad-checks/templates/checks/reconcile-debt-check.sh +94 -15
  66. package/skills/yad-checks/templates/checks/risk-map-check.sh +2 -2
  67. package/skills/yad-checks/templates/checks/spec-link.sh +63 -4
  68. package/skills/yad-checks/templates/checks/verified-commits.sh +23 -5
  69. package/skills/yad-checks/templates/github/yad-checks.yml +8 -8
  70. package/skills/yad-checks/templates/gitlab/.gitlab-ci.yml +3 -0
  71. package/skills/yad-checks/templates/gitlab/yad-checks.gitlab-ci.yml +4 -4
  72. package/skills/yad-checks/templates/gitlab/yad-product-checks.gitlab-ci.yml +16 -3
  73. package/skills/yad-checks/templates/gitlab/yad-update-guard.gitlab-ci.yml +5 -1
  74. package/skills/yad-checks/templates/gitlab/yad-verified-commits.gitlab-ci.yml +5 -1
  75. package/skills/yad-commit/SKILL.md +4 -2
  76. package/skills/yad-docs/templates/app/package-lock.json +395 -106
  77. package/skills/yad-docs/templates/app/package.json +2 -2
  78. package/skills/yad-engineer-review/SKILL.md +45 -20
  79. package/skills/yad-engineer-review/references/ship-and-record.md +42 -8
  80. package/skills/yad-epic/references/state-schema.md +83 -20
  81. package/skills/yad-implement/SKILL.md +75 -13
  82. package/skills/yad-implement/references/implement-conventions.md +8 -1
  83. package/skills/yad-implement/templates/.gitmessage +3 -0
  84. package/skills/yad-open-pr/SKILL.md +21 -0
  85. package/skills/yad-pr-template/SKILL.md +6 -2
  86. package/skills/yad-pr-template/templates/checks/pr-template.sh +85 -4
  87. package/skills/yad-pr-template/templates/checks/pr-title.sh +1 -1
  88. package/skills/yad-pr-template/templates/github/pull_request_template.md +1 -1
  89. package/skills/yad-pr-template/templates/gitlab/merge_request_templates/Default.md +1 -1
  90. package/skills/yad-product-bridge/SKILL.md +14 -1
  91. package/skills/yad-product-bridge/references/bridge.md +29 -5
  92. package/skills/yad-product-bridge/templates/gitlab/yad-gate-sync.gitlab-ci.yml +9 -4
  93. package/skills/yad-reconcile/SKILL.md +30 -0
  94. package/skills/yad-review-gate/SKILL.md +8 -2
  95. package/skills/yad-review-gate/references/gating.md +26 -1
  96. package/skills/yad-run/SKILL.md +52 -28
  97. package/skills/yad-run/references/run-loop.md +42 -21
  98. package/skills/yad-spec/SKILL.md +142 -17
  99. package/skills/yad-spec/references/spec-handoff.md +68 -5
  100. package/skills/yad-status/SKILL.md +7 -0
  101. package/skills/yad-stories/references/story-schema.md +1 -1
@@ -42,7 +42,7 @@ product_config() {
42
42
  if [ -n "${SDLC_PRODUCT_CONFIG:-}" ]; then printf '%s' "$SDLC_PRODUCT_CONFIG"; return 0; fi
43
43
  if [ -n "${SDLC_HUB_CONFIG:-}" ]; then printf '%s' "$SDLC_HUB_CONFIG"; return 0; fi
44
44
  if [ -f .sdlc/product.json ] && [ -f .sdlc/hub.json ] && ! cmp -s .sdlc/product.json .sdlc/hub.json; then
45
- echo "FAIL [product-settings]: .sdlc/product.json and .sdlc/hub.json say different things — they are one file under two names until v5. Run \`yad migrate\` in the Product to choose the copy to keep, and commit both." >&2
45
+ echo "FAIL [product-settings]: .sdlc/product.json and .sdlc/hub.json say different things — they are one file under two names until v5. In the Product, run \`yad migrate --apply --keep product\` (or \`--keep hub\`) to choose the copy to keep, then commit both files." >&2
46
46
  return 1
47
47
  fi
48
48
  if [ -f .sdlc/product.json ]; then printf '%s' .sdlc/product.json; else printf '%s' .sdlc/hub.json; fi
@@ -76,7 +76,7 @@ BASE="${1:-${SDLC_BASE:-$(resolve_base)}}"
76
76
 
77
77
  # Fail closed if the base ref can't be resolved (shallow clone / wrong base branch / unfetched ref).
78
78
  if ! git rev-parse --verify --quiet "${BASE}^{commit}" >/dev/null; then
79
- echo "FAIL [verified-commits]: base ref '${BASE}' not found — fetch full history / check the base branch."
79
+ echo "FAIL [verified-commits]: base ref '${BASE}' not found — check the code out with full history (GitHub: actions/checkout with fetch-depth: 0; GitLab: GIT_DEPTH: \"0\"), and give a base that names a fetched branch (the first argument, or SDLC_BASE)."
80
80
  exit 1
81
81
  fi
82
82
  RANGE="${BASE}..HEAD"
@@ -114,13 +114,22 @@ case "$platform" in
114
114
  ;;
115
115
  esac
116
116
 
117
- # 0 when the platform marks the commit's signature verified.
117
+ # 0 when the platform marks the commit's signature verified. On GitHub a failed API call sets
118
+ # sig_api_error=1, so the FAIL can tell "not signed" from "could not ask" (#351). It is read from gh's
119
+ # exit status: on an HTTP error (a bad token, a rate limit) gh still prints the error body to stdout.
120
+ # GitLab answers an unsigned commit with a 404, which `curl -f` cannot tell from a refused token, so it
121
+ # stays one case.
122
+ sig_api_error=0
118
123
  signature_verified() {
119
124
  local sha v body
120
125
  sha="$1"
126
+ sig_api_error=0
121
127
  case "$platform" in
122
128
  github)
123
- v="$(gh api "repos/{owner}/{repo}/commits/${sha}" --jq '.commit.verification.verified' 2>/dev/null || echo api-error)"
129
+ if ! v="$(gh api "repos/{owner}/{repo}/commits/${sha}" --jq '.commit.verification.verified' 2>/dev/null)"; then
130
+ sig_api_error=1
131
+ return 1
132
+ fi
124
133
  [ "$v" = "true" ]
125
134
  ;;
126
135
  gitlab)
@@ -172,7 +181,16 @@ while IFS= read -r sha; do
172
181
  # falls through to FAIL below.
173
182
  echo "WARN [verified-commits]: ${short} unsigned merge commit — introduces no content of its own (covered by verified parents); signature waived. (Self-hosted GitLab does not sign UI merge commits; on a platform that signs its merges an unsigned content-free merge is unusual but still harmless.)"
174
183
  else
175
- echo "FAIL [verified-commits]: ${short} signature missing/unverified — sign commits (GPG/SSH key registered on ${platform}), or the signature API was unreachable (GitLab: set GITLAB_TOKEN/SDLC_API_TOKEN with read_api)."
184
+ if [ "$sig_api_error" = 1 ]; then
185
+ echo "FAIL [verified-commits]: ${short} — the job could not ask GitHub for the commit's signature (gh api failed). The job needs GH_TOKEN set to the workflow's github.token, as the yad workflows set it; then run it again. On your own machine: install gh and run gh auth login."
186
+ else
187
+ resign="sign commits with a GPG or SSH key added to your ${platform} account (git config commit.gpgsign true; for an SSH key also gpg.format ssh and user.signingkey). On a pull request branch, re-sign the commits already made: git rebase --exec 'git commit --amend --no-edit -S' ${BASE}, and force-push. On the default branch, do not force-push: revert the commit, then land the change again through a pull request of signed commits."
188
+ if [ "$platform" = gitlab ]; then
189
+ echo "FAIL [verified-commits]: ${short} signature missing/unverified — ${resign} If the commits are signed, the job could not read GitLab's signature API: set a GITLAB_TOKEN (or SDLC_API_TOKEN) CI/CD variable with the read_api scope."
190
+ else
191
+ echo "FAIL [verified-commits]: ${short} signature missing/unverified — ${resign}"
192
+ fi
193
+ fi
176
194
  rc=1
177
195
  fi
178
196
  fi
@@ -32,9 +32,9 @@ jobs:
32
32
  - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
33
33
  with: { fetch-depth: 0 }
34
34
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
35
- # secret is set; without it this prints a note and the gate defers, as before.
35
+ # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
36
36
  - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
37
- env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}" }
37
+ env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
38
38
  - run: bash checks/contract-check.sh "origin/${{ github.base_ref }}"
39
39
 
40
40
  # E65/E66 — the risk map (.sdlc/risk-map: a risk level per directory, no names). Warnings, and the
@@ -93,9 +93,9 @@ jobs:
93
93
  - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
94
94
  with: { fetch-depth: 0 }
95
95
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
96
- # secret is set; without it this prints a note and the gate defers, as before.
96
+ # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
97
97
  - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
98
- env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}" }
98
+ env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
99
99
  - run: bash checks/lineage-check.sh "origin/${{ github.base_ref }}"
100
100
 
101
101
  epic-open:
@@ -105,9 +105,9 @@ jobs:
105
105
  - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
106
106
  with: { fetch-depth: 0 }
107
107
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
108
- # secret is set; without it this prints a note and the gate defers, as before.
108
+ # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
109
109
  - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
110
- env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}" }
110
+ env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
111
111
  - run: bash checks/epic-open.sh "origin/${{ github.base_ref }}"
112
112
 
113
113
  reconcile-debt:
@@ -117,9 +117,9 @@ jobs:
117
117
  - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
118
118
  with: { fetch-depth: 0 }
119
119
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN
120
- # secret is set; without it this prints a note and the gate defers, as before.
120
+ # secret is set; without it the gate defers, with a WARNING unless the PR comes from a fork (#345).
121
121
  - run: bash checks/product-checkout.sh "origin/${{ github.base_ref }}"
122
- env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}" }
122
+ env: { YAD_PRODUCT_TOKEN: "${{ secrets.YAD_PRODUCT_TOKEN }}", YAD_PR_FORK: "${{ github.event.pull_request.head.repo.full_name != github.repository }}" }
123
123
  - run: bash checks/reconcile-debt-check.sh "origin/${{ github.base_ref }}"
124
124
 
125
125
  # Pattern gates: commit subject + PR title + PR body all follow the convention (profile: code).
@@ -5,6 +5,9 @@ stages: [spec-link, contract-check, build-test-lint, verified-commits]
5
5
 
6
6
  default:
7
7
  image: node:${YAD_NODE_VERSION}
8
+ # Runner selection on tag-locked instances (run_untagged: false): set the YAD_RUNNER_TAGS CI/CD variable.
9
+ # When unset, current GitLab (>=15) runs the jobs untagged.
10
+ tags: [$YAD_RUNNER_TAGS]
8
11
 
9
12
  .mr_only:
10
13
  rules:
@@ -52,7 +52,7 @@ yad-contract-check:
52
52
  needs: []
53
53
  script:
54
54
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN CI/CD
55
- # variable is set (masked); without it this prints a note and the gate defers, as before.
55
+ # variable is set (masked); without it the gate defers, with a WARNING unless the MR comes from a fork (#345).
56
56
  - bash checks/product-checkout.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
57
57
  - bash checks/contract-check.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
58
58
 
@@ -81,7 +81,7 @@ yad-lineage-check:
81
81
  needs: []
82
82
  script:
83
83
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN CI/CD
84
- # variable is set (masked); without it this prints a note and the gate defers, as before.
84
+ # variable is set (masked); without it the gate defers, with a WARNING unless the MR comes from a fork (#345).
85
85
  - bash checks/product-checkout.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
86
86
  - bash checks/lineage-check.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
87
87
 
@@ -90,7 +90,7 @@ yad-epic-open:
90
90
  needs: []
91
91
  script:
92
92
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN CI/CD
93
- # variable is set (masked); without it this prints a note and the gate defers, as before.
93
+ # variable is set (masked); without it the gate defers, with a WARNING unless the MR comes from a fork (#345).
94
94
  - bash checks/product-checkout.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
95
95
  - bash checks/epic-open.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
96
96
 
@@ -99,7 +99,7 @@ yad-reconcile-debt:
99
99
  needs: []
100
100
  script:
101
101
  # E120: check the Product out where .sdlc/product-link.json says, when the YAD_PRODUCT_TOKEN CI/CD
102
- # variable is set (masked); without it this prints a note and the gate defers, as before.
102
+ # variable is set (masked); without it the gate defers, with a WARNING unless the MR comes from a fork (#345).
103
103
  - bash checks/product-checkout.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
104
104
  - bash checks/reconcile-debt-check.sh "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
105
105
 
@@ -10,11 +10,24 @@
10
10
  # the gate can tell the two apart. Commit subjects are always Conventional-Commits.
11
11
  # Job names are yad-product-prefixed so they coexist with any code-repo fragment in one pipeline; jobs use
12
12
  # `needs: []` and no `stage:` so a foreign `stages:` list can neither break nor reorder them.
13
- default:
14
- image: node:20
15
- tags: [$YAD_RUNNER_TAGS]
13
+ #
14
+ # `image:`/`tags:` live on the .yad_product_mr_only anchor below — NOT a top-level `default:`. An included
15
+ # top-level `default:` merges into the HOST root pipeline: it would set this image and tag on every one of
16
+ # the Product's own jobs, and if the root already sets a top-level `image:`, GitLab rejects the whole
17
+ # config ("image is defined in top-level and 'default:' entry"). The anchor scopes them to these jobs.
16
18
 
17
19
  .yad_product_mr_only:
20
+ image: node:${YAD_NODE_VERSION}
21
+ variables:
22
+ # A project/group CI/CD variable overrides this YAML value, so the Node line can be changed in project
23
+ # settings without editing the managed fragment (a current 20, 22 or 24 line). A shell-executor runner
24
+ # ignores `image:` — Node must then be on the runner host's PATH, and this value has no effect.
25
+ YAD_NODE_VERSION: "22"
26
+ # Runner selection: set the YAD_RUNNER_TAGS CI/CD variable (e.g. `dind_runner`) to route these jobs on
27
+ # instances whose runners are tag-locked (run_untagged: false) — it lives in project Settings → CI/CD →
28
+ # Variables, so it survives every `yad` sync. When unset, current GitLab (>=15) runs the jobs untagged;
29
+ # older versions may strand them — set a real tag if so. Single value only: `tags: [$VAR]` is one tag.
30
+ tags: [$YAD_RUNNER_TAGS]
18
31
  rules:
19
32
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
20
33
 
@@ -19,9 +19,13 @@
19
19
 
20
20
  .yad_update_guard_base: &yad_update_guard_base
21
21
  tags: [$YAD_RUNNER_TAGS]
22
- image: node:20
22
+ image: node:${YAD_NODE_VERSION}
23
23
  variables:
24
24
  GIT_DEPTH: "0" # full history so the gates can diff the pushed range
25
+ # A project/group CI/CD variable overrides this YAML value, so the Node line can be changed in project
26
+ # settings without editing the managed fragment (a current 20, 22 or 24 line). A shell-executor runner
27
+ # ignores `image:` — Node must then be on the runner host's PATH, and this value has no effect.
28
+ YAD_NODE_VERSION: "22"
25
29
  before_script:
26
30
  # First push / an unresolvable before-SHA: fall back to the commit's parent (tip commit only —
27
31
  # a rare fail-open for a multi-commit first push, preferred over failing closed).
@@ -17,9 +17,13 @@ yad-product-verified-commits:
17
17
  # project Settings → CI/CD → Variables, so it survives every `yad` sync. When unset, current
18
18
  # GitLab (>=15) runs the job untagged; older versions may strand it — set a real tag if so.
19
19
  tags: [$YAD_RUNNER_TAGS]
20
- image: node:20
20
+ image: node:${YAD_NODE_VERSION}
21
21
  variables:
22
22
  GIT_DEPTH: "0" # full history so the gate can diff against the target branch
23
+ # A project/group CI/CD variable overrides this YAML value, so the Node line can be changed in project
24
+ # settings without editing the managed fragment (a current 20, 22 or 24 line). A shell-executor runner
25
+ # ignores `image:` — Node must then be on the runner host's PATH, and this value has no effect.
26
+ YAD_NODE_VERSION: "22"
23
27
  rules:
24
28
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
25
29
  script:
@@ -57,9 +57,11 @@ staged, split it into separate commits rather than passing `--force`.
57
57
  ### Step 2 — Commit by convention
58
58
  Run the CLI from the repo root:
59
59
  ```
60
- yad commit --type <type> -m "<subject>" [--ai <id>] [--task <id>] [--contract-change] [--manual --reason "<why>"] [--dry-run]
60
+ yad commit --type <type> -m "<subject>" [--body "<text>"] [--ai <id>] [--task <id>] [--contract-change] [--manual --reason "<why>"] [--dry-run]
61
61
  ```
62
- Use `--dry-run` first to preview the exact message (subject + trailer block) without committing. The
62
+ `--body` adds a body between the subject and the trailers, as its own paragraph — for example the
63
+ `Decisions:` paragraph `yad-implement` writes (#357). `yad ship` takes no body: commit with `yad commit`, and open the
64
+ PR/MR later, when the flow says to (`yad open-pr`). Use `--dry-run` first to preview the exact message (subject + trailer block) without committing. The
63
65
  CLI validates the type, rejects a trailing period, and emits the trailers in the fixed order.
64
66
 
65
67
  ### Step 3 — Stop (no auto-advance)