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
@@ -4,6 +4,7 @@
4
4
  // strand required checks and fail verified-commits). This module is the single home of that guard.
5
5
  import { warn, fail, hand, run, forTerminal } from './lib.mjs';
6
6
  import { SETTINGS_EDIT_HINT, settingsEditHint } from './manifest.mjs';
7
+ import { worktreeAt } from './worktree-record.mjs';
7
8
 
8
9
  export const productGit = (root) => (...args) => run('git', args, { cwd: root });
9
10
 
@@ -30,6 +31,32 @@ export function resolveDefaultBranch(git, productConfig) {
30
31
  || 'main';
31
32
  }
32
33
 
34
+ // The branch a default-branch command commits on: the current one — or, in an epic's Product worktree
35
+ // (#115), which sits DETACHED because the default branch is checked out in the main tree, the default
36
+ // branch itself, so the commit is pushed as HEAD:<default>. Only when every commit HEAD holds that the
37
+ // default branch lacks (fetched first) is one of yad's own default-branch commits — each subject is
38
+ // `chore(product|gate): … [skip ci]`, so a `Revert "…"` of one, or a step's commit, is not. One a run made
39
+ // without --push, or whose push failed, is pushed by the next run, as in the main checkout. Anything else (a step's unreviewed work) must never reach the default branch. A detached
40
+ // HEAD anywhere else stays 'HEAD', and the guard below refuses it as before.
41
+ // `fetch: false` judges by the local origin/<default> — for a caller that writes a derived file and pushes
42
+ // nothing (the index refresh): a stale or missing ref can only make it skip — unless the default branch
43
+ // was rewound — and it asks no network.
44
+ export function branchToCommitOn(root, git, defaultBranch, { fetch = true } = {}) {
45
+ const branch = git('rev-parse', '--abbrev-ref', 'HEAD').stdout;
46
+ return branch === 'HEAD' && worktreeAt(root)?.repo === null && onlyYadCommitsAhead(git, defaultBranch, { fetch }) ? defaultBranch : branch;
47
+ }
48
+
49
+ // The subject every yad default-branch commit has (checkpoint, tidy, repo refresh, gate ci/repair/reopen).
50
+ export const YAD_COMMIT_SUBJECT = /^chore\((product|gate)\): .* \[skip ci\]$/;
51
+ // HEAD holds nothing origin/<default> lacks but yad's own `[skip ci]` commits. False when the fetch or the
52
+ // read fails: unknown is not safe.
53
+ export function onlyYadCommitsAhead(git, defaultBranch, { fetch = true } = {}) {
54
+ if (fetch && !git('fetch', '--quiet', 'origin', `+refs/heads/${defaultBranch}:refs/remotes/origin/${defaultBranch}`).ok) return false;
55
+ const ahead = git('log', '--format=%s', `origin/${defaultBranch}..HEAD`);
56
+ if (!ahead.ok) return false;
57
+ return ahead.stdout.split('\n').filter(Boolean).every((s) => YAD_COMMIT_SUBJECT.test(s));
58
+ }
59
+
33
60
  // Guard: only commit on the default branch. Returns true when OK; on a non-default branch it prints the
34
61
  // refusal + sets a non-zero exit code, unless `allowBranch` overrides (with a warning). `--allow-branch`
35
62
  // is the SINGLE documented override — never `--force` (which elsewhere only waives the atomic guard).
@@ -43,6 +70,12 @@ export function guardDefaultBranch(branch, defaultBranch, { allowBranch = false,
43
70
  return true;
44
71
  }
45
72
  fail(`on '${b}', not the default branch '${d}' — ${cmd} commits go to the default branch to stay out of PR-checked ranges`);
73
+ // An epic worktree (#115) refused here holds commits origin/<default> lacks, or could not fetch it.
74
+ if (branch === 'HEAD' && root && worktreeAt(root)?.repo === null) {
75
+ hand(`this epic worktree's HEAD has commits origin/${d} does not that are not yad's own (or the fetch failed) — a step's work goes on its branch and through review: \`git switch -c <step>/<epic>\` keeps it, then \`git fetch origin ${d}\` and \`git switch --detach origin/${d}\``);
76
+ process.exitCode = 1;
77
+ return false;
78
+ }
46
79
  hand(`switch to '${d}' and re-run, or pass --allow-branch to override (if '${d}' is wrong, set default_branch in ${root ? settingsEditHint(root) : SETTINGS_EDIT_HINT})`);
47
80
  process.exitCode = 1;
48
81
  return false;
package/cli/recommend.mjs CHANGED
@@ -142,7 +142,9 @@ export const RECOMMENDATIONS = Object.freeze([
142
142
 
143
143
  // ---- checking an entry ------------------------------------------------------------------------------
144
144
 
145
- const POOLS = () => TOOLBOX.filter((t) => t.tier === 'recommended').map((t) => t.id);
145
+ // The skill pools: the recommended tools `yad skill bind` takes skills from. Docker MCP is recommended too,
146
+ // but it is a gateway, not a pool (#361).
147
+ const POOLS = () => TOOLBOX.filter((t) => t.tier === 'recommended' && t.usedBy.includes('yad skill bind')).map((t) => t.id);
146
148
  const bindable = (step) => !!stepDef(step)?.skill && STEPS.some((s) => s.id === step);
147
149
 
148
150
  // Every way an entry is malformed, as sentences; [] means it is well formed. The vetting record is
@@ -20,7 +20,7 @@ import { c, ok, info, fail, hand, exists, pushWithRebase, forTerminal } from './
20
20
  import { PROJECT_FILES , productConfigPath } from './manifest.mjs';
21
21
  import { loadProduct } from './gate.mjs';
22
22
  import { platformLogin } from './platform.mjs';
23
- import { productGit, resolveDefaultBranch, guardDefaultBranch, preflightGuardReadiness } from './productcommit.mjs';
23
+ import { productGit, resolveDefaultBranch, guardDefaultBranch, preflightGuardReadiness, branchToCommitOn } from './productcommit.mjs';
24
24
  import { ensurePackIgnored, PACK_IGNORE_BLOCK } from './setup.mjs';
25
25
  import { checkpointAuthor } from './checkpoint.mjs';
26
26
  import { codeContextPathOk } from './workspace.mjs';
@@ -152,8 +152,8 @@ export async function publishCodeContext(root, { push = false, allowBranch = fal
152
152
  const registry = { repos: repos || [] };
153
153
  const git = productGit(root);
154
154
 
155
- const branch = git('rev-parse', '--abbrev-ref', 'HEAD').stdout;
156
155
  const defaultBranch = resolveDefaultBranch(git, productConfig);
156
+ const branch = branchToCommitOn(root, git, defaultBranch);
157
157
  if (!guardDefaultBranch(branch, defaultBranch, { allowBranch, cmd: 'yad repo refresh --push', root })) return;
158
158
 
159
159
  // Stage the EXPLICIT allowlist (code-maps + registry), scoped so an unrelated pre-staged file is never