yadflow 4.7.0 → 4.9.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 (96) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +43 -4
  3. package/bin/commands.mjs +5 -1
  4. package/bin/yad.mjs +169 -22
  5. package/cli/agent-guard.mjs +511 -0
  6. package/cli/agent-guide.mjs +83 -0
  7. package/cli/agent-rules.mjs +388 -0
  8. package/cli/argv-flags.mjs +7 -0
  9. package/cli/build.mjs +1 -1
  10. package/cli/ci-check.mjs +492 -0
  11. package/cli/docs.mjs +1 -1
  12. package/cli/doctor.mjs +148 -7
  13. package/cli/epic-state.mjs +3 -3
  14. package/cli/errors.mjs +1 -0
  15. package/cli/guide.mjs +549 -0
  16. package/cli/hook.mjs +32 -3
  17. package/cli/lib.mjs +46 -0
  18. package/cli/lifecycle/defaults/2.json +124 -0
  19. package/cli/lifecycle/lifecycle.schema.json +5 -2
  20. package/cli/lifecycle.mjs +16 -3
  21. package/cli/machine.mjs +141 -0
  22. package/cli/manifest.mjs +75 -0
  23. package/cli/marked-block.mjs +48 -0
  24. package/cli/members.mjs +19 -5
  25. package/cli/migrate.mjs +17 -19
  26. package/cli/next.mjs +1 -1
  27. package/cli/openpr.mjs +46 -6
  28. package/cli/plan.mjs +326 -22
  29. package/cli/preview.mjs +253 -0
  30. package/cli/protection.mjs +50 -0
  31. package/cli/reconcile.mjs +187 -26
  32. package/cli/repo.mjs +64 -3
  33. package/cli/report.mjs +62 -14
  34. package/cli/review.mjs +4 -0
  35. package/cli/setup.mjs +244 -25
  36. package/cli/signing.mjs +377 -0
  37. package/cli/story-frames.mjs +296 -0
  38. package/cli/test-agents-file.mjs +993 -0
  39. package/cli/test-ci-check.mjs +616 -0
  40. package/cli/test-guide.mjs +1267 -0
  41. package/cli/test-machine.mjs +140 -0
  42. package/cli/test-node.mjs +129 -0
  43. package/cli/test-preview.mjs +511 -0
  44. package/cli/test-setup-agent.mjs +352 -0
  45. package/cli/test-signing.mjs +524 -0
  46. package/cli/test-story-frames.mjs +339 -0
  47. package/cli/toolbox.mjs +35 -1
  48. package/cli/update-commit.mjs +313 -11
  49. package/cli/workspace.mjs +37 -12
  50. package/package.json +6 -4
  51. package/skills/sdlc/config.yaml +4 -4
  52. package/skills/sdlc/module-help.csv +1 -0
  53. package/skills/yad-change/SKILL.md +3 -2
  54. package/skills/yad-checks/SKILL.md +29 -9
  55. package/skills/yad-checks/references/check-gates.md +9 -4
  56. package/skills/yad-checks/templates/checks/package-manager.sh +1 -1
  57. package/skills/yad-checks/templates/github/yad-checks.yml +1 -1
  58. package/skills/yad-checks/templates/gitlab/.gitlab-ci.yml +1 -1
  59. package/skills/yad-checks/templates/gitlab/yad-checks.gitlab-ci.yml +1 -1
  60. package/skills/yad-checks/templates/gitlab/yad-product-checks.gitlab-ci.yml +1 -1
  61. package/skills/yad-checks/templates/gitlab/yad-update-guard.gitlab-ci.yml +1 -1
  62. package/skills/yad-checks/templates/gitlab/yad-verified-commits.gitlab-ci.yml +1 -1
  63. package/skills/yad-checks/templates/hooks/agent-guard.mjs +116 -0
  64. package/skills/yad-commit/SKILL.md +4 -3
  65. package/skills/yad-connect-design/SKILL.md +7 -4
  66. package/skills/yad-connect-design/references/design-context.md +23 -0
  67. package/skills/yad-connect-design/references/design-registry.md +3 -3
  68. package/skills/yad-connect-repos/SKILL.md +13 -3
  69. package/skills/yad-connect-repos/references/code-context.md +2 -1
  70. package/skills/yad-connect-repos/references/repos-registry.md +2 -1
  71. package/skills/yad-docs-overview/references/pipeline-model.md +2 -2
  72. package/skills/yad-engineer-review/SKILL.md +25 -7
  73. package/skills/yad-engineer-review/references/ship-and-record.md +7 -4
  74. package/skills/yad-epic/SKILL.md +2 -1
  75. package/skills/yad-epic/references/state-schema.md +7 -1
  76. package/skills/yad-guide/SKILL.md +192 -0
  77. package/skills/yad-implement/SKILL.md +14 -0
  78. package/skills/yad-open-pr/SKILL.md +5 -2
  79. package/skills/yad-pair-review/SKILL.md +19 -5
  80. package/skills/yad-pr-template/templates/github/pull_request_template.md +1 -0
  81. package/skills/yad-pr-template/templates/gitlab/merge_request_templates/Default.md +1 -0
  82. package/skills/yad-product-bridge/SKILL.md +32 -13
  83. package/skills/yad-product-bridge/references/bridge.md +6 -3
  84. package/skills/yad-product-bridge/templates/github/yad-gate-sync.yml +2 -2
  85. package/skills/yad-product-bridge/templates/gitlab/yad-gate-sync.gitlab-ci.yml +1 -1
  86. package/skills/yad-report/SKILL.md +15 -0
  87. package/skills/yad-review-companion/SKILL.md +9 -4
  88. package/skills/yad-review-gate/SKILL.md +13 -9
  89. package/skills/yad-review-gate/references/gating.md +1 -1
  90. package/skills/yad-run/SKILL.md +10 -6
  91. package/skills/yad-run/references/run-loop.md +2 -1
  92. package/skills/yad-spec/SKILL.md +21 -0
  93. package/skills/yad-stories/SKILL.md +22 -0
  94. package/skills/yad-stories/references/story-schema.md +1 -0
  95. package/skills/yad-sync-repos/SKILL.md +2 -1
  96. package/skills/yad-ui/SKILL.md +7 -2
package/cli/repo.mjs CHANGED
@@ -12,6 +12,7 @@ import { PROJECT_FILES } from './manifest.mjs';
12
12
  import { judgeRepo, cloneMissingRepos, reportClones, readRegistry, codeContextPathOk, CODE_CONTEXT_DIR, runnable, shown } from './workspace.mjs';
13
13
  import { gitHead, packRepo } from './setup.mjs';
14
14
  import { publishCodeContext, packOf, codeMapOf } from './repo-publish.mjs';
15
+ import { PREVIEW_KEY, patternProblems } from './preview.mjs';
15
16
 
16
17
  // Why `refresh` will not pack this entry, or null when it will (E81): see the loop in `runRepo`.
17
18
  function notPackable(root, repo, j) {
@@ -59,7 +60,7 @@ function defaultBranch(cwd, repo) {
59
60
  return !/^[-+]/.test(b) && git(cwd, 'check-ref-format', `refs/heads/${b}`).ok ? b : null;
60
61
  }
61
62
 
62
- export async function runRepo(root, { action = 'list', name, today, push = false, allowBranch = false } = {}) {
63
+ export async function runRepo(root, { action = 'list', name, pattern, clear = false, today, push = false, allowBranch = false } = {}) {
63
64
  const { regPath, registry, problem } = load(root);
64
65
  if (problem) { fail(`${problem} — fix it in the Product and re-run`); process.exitCode = 1; return { action, repos: [] }; }
65
66
  if (!registry.repos.length) { warn('no repos registered (.sdlc/repos.json) — run `yad setup`'); return { action, repos: [] }; }
@@ -88,7 +89,9 @@ export async function runRepo(root, { action = 'list', name, today, push = false
88
89
  }
89
90
  const { head, stale, unknown, neverPacked } = staleness(root, repo);
90
91
  rows.push({ name: repo.name ?? null, path: repo.path ?? null, head: head || null, syncedHead: repo.syncedHead ?? null,
91
- state: unknown ? 'unreadable' : neverPacked ? 'no-pack' : stale ? 'stale' : 'fresh' });
92
+ state: unknown ? 'unreadable' : neverPacked ? 'no-pack' : stale ? 'stale' : 'fresh',
93
+ ...(typeof repo[PREVIEW_KEY] === 'string' ? { preview_url: repo[PREVIEW_KEY] } : {}) });
94
+ if (typeof repo[PREVIEW_KEY] === 'string') info(`${j.name} ${c.dim('— preview')} ${shown(repo[PREVIEW_KEY])}`);
92
95
  if (unknown) { warn(`${j.name} ${c.dim(`(${j.path})`)} — HEAD unreadable`); continue; }
93
96
  if (neverPacked) { staleCount++; warn(`${j.name} ${c.dim(`(${j.path})`)} — ${c.yellow('no code-context pack yet')} (registered without one)`); }
94
97
  else if (stale) { staleCount++; warn(`${j.name} ${c.dim(`(${j.path})`)} — ${c.yellow('stale')} (HEAD moved since last pack)`); }
@@ -225,7 +228,65 @@ export async function runRepo(root, { action = 'list', name, today, push = false
225
228
  return { action, ...repos };
226
229
  }
227
230
 
228
- fail(`unknown repo action: ${action} (list | refresh | sync | clone)`);
231
+ if (action === 'preview') return previewAction(root, entries, regPath, registry, { name, pattern, clear, push });
232
+
233
+ fail(`unknown repo action: ${action} (list | refresh | sync | clone | preview)`);
229
234
  process.exitCode = 1;
230
235
  return { action };
231
236
  }
237
+
238
+ // `yad repo preview <name> [<pattern>] [--clear]` (#359): show, set or clear the repo's preview address
239
+ // pattern — `https://pr-{pr}.myapp.dev`, filled per PR/MR so a live design check runs against the
240
+ // deployed copy. A team setting in the Product's registry: written here, committed by the person.
241
+ function previewAction(root, entries, regPath, registry, { name, pattern, clear, push }) {
242
+ const done = (extra) => ({ action: 'preview', name: name ?? null, ...extra });
243
+ const usage = 'yad repo preview <name> [<pattern>] [--clear]';
244
+ // It writes one shared file and commits nothing: `--push` would read as a promise it does not keep.
245
+ if (push) { fail(`--push does not apply to \`yad repo preview\` — it writes ${PROJECT_FILES.reposRegistry}; commit that in the Product`); process.exitCode = 1; return done({ preview_url: null }); }
246
+ if (!name) { fail(`usage: ${usage}`); process.exitCode = 1; return done({ preview_url: null }); }
247
+ const matches = entries.filter((r) => r.name === name);
248
+ if (!matches.length) { fail(`unknown repo: ${shown(name)}`); process.exitCode = 1; return done({ preview_url: null }); }
249
+ if (matches.length > 1) { fail(`${matches.length} entries in ${PROJECT_FILES.reposRegistry} are named ${shown(name)} — fix the registry first`); process.exitCode = 1; return done({ preview_url: null }); }
250
+ const repo = matches[0];
251
+ const current = typeof repo[PREVIEW_KEY] === 'string' ? repo[PREVIEW_KEY] : null;
252
+ if (clear && pattern !== undefined) { fail(`give a pattern or --clear, not both (${usage})`); process.exitCode = 1; return done({ preview_url: current }); }
253
+
254
+ if (!clear && pattern === undefined) {
255
+ if (repo[PREVIEW_KEY] == null) info(`${shown(name)} has no preview address pattern — set one with \`${usage}\``);
256
+ else {
257
+ const problems = patternProblems(repo[PREVIEW_KEY]);
258
+ if (problems.length) warn(`${shown(name)}'s preview_url cannot be used: it ${problems.join('; ')} — set it again with \`${usage}\``);
259
+ else ok(`${shown(name)} — preview ${shown(current)}`);
260
+ }
261
+ return done({ preview_url: current, problems: repo[PREVIEW_KEY] == null ? [] : patternProblems(repo[PREVIEW_KEY]) });
262
+ }
263
+
264
+ if (!clear) {
265
+ const problems = patternProblems(pattern);
266
+ if (problems.length) {
267
+ fail(`the preview address pattern ${problems.join('; ')} — nothing written`);
268
+ hand('a pattern is a URL that may hold {pr}, {branch} and {repo}, for example https://pr-{pr}.myapp.dev');
269
+ process.exitCode = 1;
270
+ return done({ preview_url: current, problems });
271
+ }
272
+ }
273
+ // Never through a `.sdlc` the Product commits as a link (as `refresh`): the write would land where it points.
274
+ let sdlcLinked = false;
275
+ try { sdlcLinked = fs.lstatSync(path.dirname(regPath)).isSymbolicLink(); } catch { /* not there */ }
276
+ if (sdlcLinked) {
277
+ fail(`${path.dirname(PROJECT_FILES.reposRegistry)} in the Product is a link — ${PROJECT_FILES.reposRegistry} was not written`);
278
+ process.exitCode = 1;
279
+ return done({ preview_url: current });
280
+ }
281
+ if (clear) {
282
+ if (!(PREVIEW_KEY in repo)) { info(`${shown(name)} has no preview address pattern — nothing to clear`); return done({ preview_url: null, changed: false }); }
283
+ delete repo[PREVIEW_KEY];
284
+ } else {
285
+ if (current === pattern) { info(`${shown(name)} already has that preview address pattern`); return done({ preview_url: current, changed: false }); }
286
+ repo[PREVIEW_KEY] = pattern;
287
+ }
288
+ writeJSON(regPath, registry);
289
+ ok(clear ? `${shown(name)} — preview address pattern cleared` : `${shown(name)} — preview ${shown(pattern)}`);
290
+ hand(`commit ${PROJECT_FILES.reposRegistry} in the Product so the team shares it`);
291
+ return done({ preview_url: clear ? null : pattern, changed: true });
292
+ }
package/cli/report.mjs CHANGED
@@ -7,6 +7,7 @@
7
7
  // no absolute paths, hostnames, git URLs, repo names, logins/emails, epic/story IDs, branch
8
8
  // names, or flag values ever leave the machine. The user sees the exact payload and confirms before
9
9
  // anything is posted. See memory: no-private-data-in-reports.
10
+ import { createHash } from 'node:crypto';
10
11
  import { c, log, info, ok, warn, note, ask, askYesNo, has, readJSON, run, inJSON } from './lib.mjs';
11
12
  import { VERSION, UPSTREAM_REPO , productConfigPath } from './manifest.mjs';
12
13
  import { createIssue, searchIssues, issueUrl, platformAuthed } from './platform.mjs';
@@ -107,8 +108,13 @@ export function sanitizeContext(dir, { error = null, argv = process.argv.slice(2
107
108
 
108
109
  // ---- body assembly ------------------------------------------------------------------------------
109
110
 
111
+ // What a report is (E158): a `bug` (something broke) or an `enhancement` (yadflow could do better). It sets
112
+ // the label, and an enhancement's title and body.
113
+ export const REPORT_KINDS = ['bug', 'enhancement'];
114
+
110
115
  // Title: prefer the error code + command; fall back to the (scrubbed) summary.
111
- export function buildTitle(ctx, summary) {
116
+ export function buildTitle(ctx, summary, kind = 'bug') {
117
+ if (kind === 'enhancement') return `[report] Enhancement: ${summary ? summary.slice(0, 72) : 'yad idea'}`;
112
118
  const code = ctx.error?.code ? ` [${ctx.error.code}]` : '';
113
119
  const cmd = ctx.command && ctx.command !== '(none)' ? `\`yad ${ctx.command}\`` : 'yad';
114
120
  if (ctx.error) return `[report] ${cmd} failed${code}`;
@@ -116,10 +122,12 @@ export function buildTitle(ctx, summary) {
116
122
  }
117
123
 
118
124
  // Body mirrors the fields of .github/ISSUE_TEMPLATE/bug_report.yml — but only the safe subset.
119
- export function buildBody(ctx, summary) {
125
+ export function buildBody(ctx, summary, kind = 'bug') {
120
126
  const lines = [];
121
- lines.push('### What happened?', '', summary || '_(no summary provided)_', '');
122
- lines.push(`Command: \`yad ${ctx.command}\``, '');
127
+ if (kind === 'enhancement') lines.push('### What would help?', '', summary || '_(no summary provided)_', '');
128
+ else lines.push('### What happened?', '', summary || '_(no summary provided)_', '');
129
+ // An idea is not about a command line; a bug is.
130
+ if (kind !== 'enhancement') lines.push(`Command: \`yad ${ctx.command}\``, '');
123
131
  lines.push('### Environment');
124
132
  lines.push(`- yadflow: \`${ctx.version}\``);
125
133
  lines.push(`- node: \`${ctx.node}\``);
@@ -129,7 +137,7 @@ export function buildBody(ctx, summary) {
129
137
  if (ctx.glab) lines.push(`- glab: ${ctx.glab}`);
130
138
  lines.push(`- platform: ${ctx.platform}`);
131
139
  lines.push('');
132
- if (ctx.error) {
140
+ if (ctx.error && kind !== 'enhancement') {
133
141
  lines.push('### Error');
134
142
  if (ctx.error.code) lines.push(`- code: \`${ctx.error.code}\``);
135
143
  lines.push(`- message: ${ctx.error.message}`);
@@ -140,6 +148,16 @@ export function buildBody(ctx, summary) {
140
148
  return lines.join('\n');
141
149
  }
142
150
 
151
+ // The check value for `--post --confirm` (E158): a hash of exactly what would be posted. `--json` returns it
152
+ // with the preview; `--post` posts only when the text it builds again hashes the same, so what goes up is
153
+ // exactly what the person saw.
154
+ export const confirmHash = ({ title, body, labels }) => createHash('sha256').update(JSON.stringify([title, body, labels])).digest('hex');
155
+
156
+ // The report's own flags never reach the posted command line: the preview and the post must build the same
157
+ // text, and they are run with different flags.
158
+ const OWN_FLAGS = new Set(['--json', '--post', '--confirm', '--kind']);
159
+ const withoutOwnFlags = (argv) => argv.filter((a) => !OWN_FLAGS.has(String(a).split('=')[0]));
160
+
143
161
  // ---- open a URL (best-effort) -------------------------------------------------------------------
144
162
  function openUrl(url, { runner = run } = {}) {
145
163
  const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
@@ -154,6 +172,10 @@ export async function runReport(dir, opts = {}) {
154
172
  const {
155
173
  error = null,
156
174
  message = null,
175
+ // E158: `bug` or `enhancement`; and `post` with `confirm`, for an agent posting the preview the person saw.
176
+ kind = 'bug',
177
+ post = false,
178
+ confirm = null,
157
179
  // injectable seams (tests never shell out or prompt)
158
180
  filer = createIssue,
159
181
  searcher = searchIssues,
@@ -163,11 +185,13 @@ export async function runReport(dir, opts = {}) {
163
185
  authed = () => platformAuthed(UPSTREAM_PLATFORM),
164
186
  argv = process.argv.slice(2),
165
187
  // A --json run never prompts, and so never posts (E1): it answers with the payload and the prefilled URL.
166
- interactive = !process.env.SDLC_NONINTERACTIVE && !inJSON(),
188
+ // Nor does a run with no terminal (E158 review 1): an agent's `yad report` would otherwise read its "yes"
189
+ // from a pipe and post text no person saw. An agent posts only through --post --confirm.
190
+ interactive = !process.env.SDLC_NONINTERACTIVE && !inJSON() && !!process.stdin.isTTY && !!process.stdout.isTTY,
167
191
  } = opts;
168
192
 
169
193
  try {
170
- const ctx = sanitizeContext(dir, { error, argv });
194
+ const ctx = sanitizeContext(dir, { error, argv: withoutOwnFlags(argv) });
171
195
 
172
196
  // Summary — the user's own description (scrubbed for stray paths/urls). Ask if interactive.
173
197
  let summary = message ? scrub(message) : '';
@@ -176,9 +200,33 @@ export async function runReport(dir, opts = {}) {
176
200
  summary = a ? scrub(a) : '';
177
201
  }
178
202
 
179
- const title = buildTitle(ctx, summary);
180
- const body = buildBody(ctx, summary);
181
- const labels = ['bug'];
203
+ const title = buildTitle(ctx, summary, kind);
204
+ const body = buildBody(ctx, summary, kind);
205
+ const labels = [kind === 'enhancement' ? 'enhancement' : 'bug'];
206
+ const check = confirmHash({ title, body, labels });
207
+
208
+ // --post --confirm: post with no prompt, but only the text the person saw (its hash). Anything else posts
209
+ // nothing: the agent shows the new preview and asks again.
210
+ if (post) {
211
+ if (confirm !== check) {
212
+ warn('not posted: this report is not the text that was shown (it changed, or --confirm is not the value its --json preview gave) — preview it again with --json, show it, and ask again');
213
+ process.exitCode = 1;
214
+ return { filed: false, url: null, kind, title, body, labels, related: [], confirm: check, refused: 'confirm-mismatch' };
215
+ }
216
+ if (authed()) {
217
+ const r = filer(UPSTREAM_PLATFORM, UPSTREAM_REPO, { title, body, labels });
218
+ if (r.ok) {
219
+ ok(`Issue filed: ${c.cyan(r.url)}`);
220
+ return { filed: true, url: r.url, kind, title, body, labels, related: [], confirm: check };
221
+ }
222
+ warn(`Could not file automatically: ${r.reason || 'unknown error'}`);
223
+ } else {
224
+ note('gh is not logged in — file it here instead (prefilled); the person opens the link:');
225
+ }
226
+ const url = issueUrl(UPSTREAM_PLATFORM, UPSTREAM_REPO, { title, body, labels });
227
+ log(` → ${c.cyan(url)}`);
228
+ return { filed: false, url, kind, title, body, labels, related: [], confirm: check };
229
+ }
182
230
 
183
231
  // Dedup — search open issues by the error code (or the first summary word). Advisory: a failed
184
232
  // search just skips this step, it never blocks filing.
@@ -193,7 +241,7 @@ export async function runReport(dir, opts = {}) {
193
241
  if (interactive && await prompter('Open an existing issue instead of filing a new one?', true)) {
194
242
  opener(matches[0].url);
195
243
  log(`\n → ${c.cyan(matches[0].url)}`);
196
- return { filed: false, url: matches[0].url, deduped: true, title, body, labels, related };
244
+ return { filed: false, url: matches[0].url, deduped: true, kind, title, body, labels, related, confirm: check };
197
245
  }
198
246
  }
199
247
  }
@@ -213,7 +261,7 @@ export async function runReport(dir, opts = {}) {
213
261
  note(interactive ? 'Not posted. You can file it yourself here (prefilled):' : 'Non-interactive — not posted. File it here (prefilled):');
214
262
  log(` → ${c.cyan(url)}`);
215
263
  // The payload exactly as it would be posted, for a --json caller to show or file itself.
216
- return { filed: false, url, title, body, labels, related };
264
+ return { filed: false, url, kind, title, body, labels, related, confirm: check };
217
265
  }
218
266
 
219
267
  // File directly when the CLI is authenticated; otherwise fall back to the prefilled URL.
@@ -221,7 +269,7 @@ export async function runReport(dir, opts = {}) {
221
269
  const r = filer(UPSTREAM_PLATFORM, UPSTREAM_REPO, { title, body, labels });
222
270
  if (r.ok) {
223
271
  ok(`Issue filed: ${c.cyan(r.url)}`);
224
- return { filed: true, url: r.url, title, body, labels, related };
272
+ return { filed: true, url: r.url, kind, title, body, labels, related, confirm: check };
225
273
  }
226
274
  warn(`Could not file automatically: ${r.reason || 'unknown error'}`);
227
275
  } else {
@@ -230,7 +278,7 @@ export async function runReport(dir, opts = {}) {
230
278
  const url = issueUrl(UPSTREAM_PLATFORM, UPSTREAM_REPO, { title, body, labels });
231
279
  opener(url);
232
280
  log(` → ${c.cyan(url)}`);
233
- return { filed: false, url, title, body, labels, related };
281
+ return { filed: false, url, kind, title, body, labels, related, confirm: check };
234
282
  } catch (e) {
235
283
  // Reporting itself must never crash the CLI.
236
284
  note(`could not complete the report (${e?.message || e}) — please file manually at https://github.com/${UPSTREAM_REPO}/issues`);
package/cli/review.mjs CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  } from './platform.mjs';
18
18
  import { upsertTrailerBlock, nudgeMessage, parseEngagement } from './companion.mjs';
19
19
  import { sequenceDiff } from './walkthrough.mjs';
20
+ import { resolvePreview } from './preview.mjs';
20
21
 
21
22
  const NUDGE_CMD = 'yad review chat';
22
23
 
@@ -68,6 +69,9 @@ function contextBundle(root, { repo, dir, product, pr, runner = run } = {}) {
68
69
  codeMap: meta?.name ? path.join(rr.productRoot, '.sdlc/code-context', meta.name, 'code-map.md') : null,
69
70
  pack: meta?.name ? path.join(rr.productRoot, '.sdlc/code-context', meta.name, 'pack.md') : null,
70
71
  contract: meta?.contract || null,
72
+ // Where a live design check (the page at several screen widths) runs (#359): the PR's preview
73
+ // address, or `local-only` with why — the review then says the check ran locally only.
74
+ preview: resolvePreview({ meta, platform, pr: pr || null, base, cwd: repoRoot, runner }),
71
75
  markers: {
72
76
  trailerBegin: '<!-- yad:trailer -->', noblock: '<!-- yad:noblock -->',
73
77
  engagementVerified: '<!-- yad:engagement verified -->', pair: '<!-- yad:pair -->',