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
@@ -0,0 +1,141 @@
1
+ // #352 — the machine setup local work depends on, for `yad doctor`. Three checks, each from what is on disk
2
+ // here (no network):
3
+ // node the Node running yad (the active one, e.g. nvm's default) against the version each repo pins:
4
+ // .nvmrc, .node-version, .tool-versions (nodejs), package.json `engines.node` and `volta.node`.
5
+ // A pin yad cannot read as a version (`lts/*`, a URL) is left out, never guessed.
6
+ // docker Docker running, only where a repo itself asks for it: a compose file, a Dockerfile, a `docker`
7
+ // call in its package.json scripts, or a docker hook in its pre-commit config. yad's own gates
8
+ // need no Docker, so a repo that names none is never asked about.
9
+ // glab more than one glab config file. glab then reads only one and ignores the other (a login saved
10
+ // there is not used), and warns on every run, which breaks JSON for a tool that reads its output
11
+ // and its errors together.
12
+ import fs from 'node:fs';
13
+ import os from 'node:os';
14
+ import path from 'node:path';
15
+ import { run, readJSON, isPlainObject, forTerminal } from './lib.mjs';
16
+
17
+ const read = (file) => { try { return fs.readFileSync(file, 'utf8'); } catch { return null; } };
18
+
19
+ // The Node versions a folder pins, each { source, want }.
20
+ export function nodePins(dir) {
21
+ const pins = [];
22
+ for (const f of ['.nvmrc', '.node-version']) {
23
+ const t = read(path.join(dir, f));
24
+ const v = t?.split('\n').map((l) => l.replace(/#.*/, '').trim()).find(Boolean);
25
+ if (v) pins.push({ source: f, want: v });
26
+ }
27
+ const tv = read(path.join(dir, '.tool-versions'));
28
+ // A line may list fallbacks (`nodejs 24.2.0 22.0.0`): the first is the one in use, and the one read.
29
+ const line = tv?.split('\n').map((l) => l.replace(/#.*/, '').trim()).find((l) => /^(nodejs|node)\s/.test(l));
30
+ if (line) pins.push({ source: '.tool-versions', want: line.split(/\s+/)[1] });
31
+ const pkg = readJSON(path.join(dir, 'package.json'), null);
32
+ if (isPlainObject(pkg)) {
33
+ if (typeof pkg.engines?.node === 'string' && pkg.engines.node.trim()) pins.push({ source: 'package.json engines.node', want: pkg.engines.node.trim() });
34
+ if (typeof pkg.volta?.node === 'string' && pkg.volta.node.trim()) pins.push({ source: 'package.json volta.node', want: pkg.volta.node.trim() });
35
+ }
36
+ return pins;
37
+ }
38
+
39
+ const parts = (v) => {
40
+ const m = /^v?(\d+)(?:\.(\d+|x|\*))?(?:\.(\d+|x|\*))?$/i.exec(String(v).trim());
41
+ if (!m) return null;
42
+ const n = (x) => (x === undefined || /^[x*]$/i.test(x) ? null : Number(x));
43
+ return [Number(m[1]), n(m[2]), n(m[3])];
44
+ };
45
+ const cmp = (a, b) => { for (let i = 0; i < 3; i++) { const d = (a[i] ?? 0) - (b[i] ?? 0); if (d) return d; } return 0; };
46
+
47
+ // Does `version` (x.y.z) meet `spec`? true / false, or null when the spec is not one yad reads (a name such
48
+ // as `lts/*`, a URL): never guessed. Reads exact and partial versions (`24`, `22.8`), `x` and `*`, the
49
+ // operators >= > <= < = (with or without a space before the version), ^ and ~, `a - b`, spaces (all must
50
+ // hold) and `||` (any may). A pre-release (`24.0.0-rc.1`), in the spec or the running Node, is not read.
51
+ export function satisfies(version, spec) {
52
+ const have = parts(version);
53
+ if (!have) return null;
54
+ const alts = String(spec).split('||').map((s) => s.trim());
55
+ let unknown = false;
56
+ for (const alt of alts) {
57
+ if (alt === '' || alt === '*' || /^x$/i.test(alt)) return true;
58
+ const hyphen = /^(\S+)\s+-\s+(\S+)$/.exec(alt);
59
+ // `>= 22` is `>=22`: an operator is joined to its version before the spaces split the terms.
60
+ const joined = alt.replace(/(>=|<=|>|<|=|\^|~)\s+/g, '$1');
61
+ const terms = hyphen ? [`>=${hyphen[1]}`, `<=${hyphen[2]}`] : joined.split(/\s+/).filter(Boolean);
62
+ let all = true;
63
+ for (const term of terms) {
64
+ const m = /^(>=|<=|>|<|=|\^|~)?\s*(.+)$/.exec(term);
65
+ const want = m && parts(m[2]);
66
+ if (!want) { unknown = true; all = false; break; }
67
+ const op = m[1] || '';
68
+ const c = cmp(have, want);
69
+ const lead = want.findIndex((x) => x === null);
70
+ let ok;
71
+ if (op === '>=') ok = c >= 0;
72
+ // `>24` is above every 24.x.y (npm reads it as >=25.0.0): only the parts it names are compared.
73
+ else if (op === '>') ok = lead >= 0 ? cmp(have.slice(0, lead), want.slice(0, lead)) > 0 : c > 0;
74
+ else if (op === '<=') ok = c <= 0 || (lead >= 0 && have.slice(0, lead).every((x, i) => x === want[i]));
75
+ else if (op === '<') ok = c < 0;
76
+ else if (op === '^') {
77
+ ok = c >= 0 && (want[0] > 0 ? have[0] === want[0]
78
+ : want[1] === null || want[1] > 0 ? have[0] === 0 && (want[1] === null || have[1] === want[1])
79
+ : have[0] === 0 && have[1] === 0 && (want[2] === null || have[2] === want[2]));
80
+ }
81
+ else if (op === '~') ok = c >= 0 && have[0] === want[0] && (want[1] === null || have[1] === want[1]);
82
+ // A bare or `=` version: the parts it names must match (`24` is any 24.x.y).
83
+ else ok = want.every((x, i) => x === null || x === have[i]);
84
+ if (!ok) { all = false; break; }
85
+ }
86
+ if (all) return true;
87
+ }
88
+ return unknown ? null : false;
89
+ }
90
+
91
+ // What the person runs to fix a Node mismatch: nvm's commands when nvm is here, else plain words.
92
+ export function nodeFix(rawWant, { env = process.env, home = os.homedir() } = {}) {
93
+ const want = forTerminal(rawWant);
94
+ const exact = /^v?\d+(\.\d+){0,2}$/.test(want) ? want.replace(/^v/, '') : null;
95
+ const nvm = !!env.NVM_DIR || fs.existsSync(path.join(home, '.nvm'));
96
+ if (nvm && exact) return `nvm install ${exact} && nvm use ${exact} (and \`nvm alias default ${exact}\` to make it the default in new shells)`;
97
+ if (nvm) return `nvm install <a version that meets ${want}> && nvm use <that version>`;
98
+ return `install Node ${want} (or switch to it with your version manager)`;
99
+ }
100
+
101
+ // Why a folder needs Docker: the files and lines that ask for it ([] when none). Script names come from the
102
+ // repo, so they are cleaned for the terminal here.
103
+ export function dockerReasons(dir) {
104
+ const why = [];
105
+ let names = [];
106
+ try { names = fs.readdirSync(dir); } catch { /* not readable: no reasons */ }
107
+ for (const f of names) {
108
+ if (/^(docker-)?compose\.ya?ml$/i.test(f) || /^dockerfile(\..+)?$/i.test(f) || /\.dockerfile$/i.test(f)) why.push(forTerminal(f));
109
+ }
110
+ const pkg = readJSON(path.join(dir, 'package.json'), null);
111
+ const scripts = isPlainObject(pkg?.scripts) ? pkg.scripts : {};
112
+ // docker run as a command: at the start, after `&&` `||` `;` `|` `(`, after `npx`, or by its path —
113
+ // not the word inside another command (`--ignore-pattern docker`, `echo docker`).
114
+ const cmd = /(^|[;&|(]\s*|\bnpx\s+(-y\s+)?)(\S*\/)?docker(-compose)?(\s|$)/;
115
+ const named = Object.entries(scripts).filter(([, v]) => typeof v === 'string' && cmd.test(v)).map(([k]) => forTerminal(k));
116
+ if (named.length) why.push(`package.json scripts: ${named.join(', ')}`);
117
+ const pre = read(path.join(dir, '.pre-commit-config.yaml'));
118
+ if (pre && /^\s*language:\s*["']?(docker|docker_image)["']?\s*(#.*)?$/m.test(pre)) why.push('.pre-commit-config.yaml (a docker hook)');
119
+ return why;
120
+ }
121
+
122
+ // Is Docker here and running? 'running' | 'stopped' (the CLI is here, the daemon does not answer) |
123
+ // 'missing' (no docker command).
124
+ export function dockerState({ runner = run } = {}) {
125
+ if (!runner(process.platform === 'win32' ? 'where' : 'which', ['docker']).ok) return 'missing';
126
+ return runner('docker', ['info', '--format', '{{.ServerVersion}}'], { timeout: 8000 }).ok ? 'running' : 'stopped';
127
+ }
128
+
129
+ // The glab config files that exist on this machine, in the places glab looks. GLAB_CONFIG_DIR, or else
130
+ // XDG_CONFIG_HOME, names the one place glab reads (it then warns about no other); without them glab looks
131
+ // in ~/.config and the system's own folder, and warns when both hold a config.
132
+ export function glabConfigs({ env = process.env, home = os.homedir(), platform = process.platform } = {}) {
133
+ const places = env.GLAB_CONFIG_DIR ? [path.join(env.GLAB_CONFIG_DIR, 'config.yml')]
134
+ : env.XDG_CONFIG_HOME ? [path.join(env.XDG_CONFIG_HOME, 'glab-cli', 'config.yml')]
135
+ : [
136
+ path.join(home, '.config', 'glab-cli', 'config.yml'),
137
+ platform === 'darwin' && path.join(home, 'Library', 'Application Support', 'glab-cli', 'config.yml'),
138
+ platform === 'win32' && env.APPDATA && path.join(env.APPDATA, 'glab-cli', 'config.yml'),
139
+ ].filter(Boolean);
140
+ return [...new Set(places)].filter((f) => fs.existsSync(f));
141
+ }
package/cli/manifest.mjs CHANGED
@@ -63,6 +63,8 @@ export const SKILLS = [
63
63
  'yad-defects',
64
64
  'yad-reconcile',
65
65
  'yad-stub',
66
+ 'yad-issues',
67
+ 'yad-scan',
66
68
  ];
67
69
 
68
70
  // Old skill names. `check`/`update` migrate any install still carrying one: remove the old copy,
@@ -189,7 +191,7 @@ export const MODULE_CONFIG = '.sdlc/config.yaml';
189
191
  // the fallback `registerDesign`/setup use when an unknown tool is named, and `none` is the explicit
190
192
  // markdown-only choice. (doctor does NOT fall back — an unknown tool there is a hard YAD-CFG-002 fail,
191
193
  // mirroring how registerRepo falls back on platform while doctor fails on an unknown Product platform.)
192
- export const DESIGN_TOOLS = ['figma', 'pencil'];
194
+ export const DESIGN_TOOLS = ['figma', 'pencil', 'openpencil'];
193
195
  export const DESIGN_PRIMARY = 'figma';
194
196
 
195
197
  // Supported testing-tool adapters (mirrors skills/sdlc/config.yaml `testing.tools`); `TESTING_PRIMARY`
@@ -492,6 +494,8 @@ export const REPO_WIRING = {
492
494
  ],
493
495
  github: [
494
496
  { src: 'skills/yad-checks/templates/github/yad-checks.yml', dest: '.github/workflows/yad-checks.yml' },
497
+ // pr-title + pr-template, the only checks an edit of the PR text re-runs (#425).
498
+ { src: 'skills/yad-checks/templates/github/yad-pr-text.yml', dest: '.github/workflows/yad-pr-text.yml' },
495
499
  // Integrity gate for direct-to-default pushes (`yad update --push`): verified-commits + commit-message.
496
500
  { src: 'skills/yad-checks/templates/github/yad-update-guard.yml', dest: '.github/workflows/yad-update-guard.yml' },
497
501
  { src: 'skills/yad-pr-template/templates/github/pull_request_template.md', dest: '.github/pull_request_template.md' },
@@ -549,6 +553,7 @@ export const PRODUCT_WIRING = {
549
553
  { src: 'skills/yad-product-bridge/templates/github/yad-gate-sync.yml', dest: '.github/workflows/yad-gate-sync.yml' },
550
554
  { src: 'skills/yad-checks/templates/github/yad-verified-commits.yml', dest: '.github/workflows/yad-verified-commits.yml' },
551
555
  { src: 'skills/yad-checks/templates/github/yad-product-checks.yml', dest: '.github/workflows/yad-product-checks.yml' },
556
+ { src: 'skills/yad-checks/templates/github/yad-product-pr-text.yml', dest: '.github/workflows/yad-product-pr-text.yml' },
552
557
  // Integrity gate for the Product's own direct-to-default pushes (`yad update --push`; the machine-
553
558
  // state `yad checkpoint`/`gate ci` commits carry [skip ci] and are intentionally not re-checked).
554
559
  { src: 'skills/yad-checks/templates/github/yad-update-guard.yml', dest: '.github/workflows/yad-update-guard.yml' },
@@ -574,8 +579,9 @@ export const PROTECTION_GUIDE_URL = 'https://github.com/abdelrahmannasr/yadflow/
574
579
  // check is named after its job (the jobs set no `name:`), on GitLab a job is the job's key. `yad ci check`
575
580
  // reads the GitHub list against the branch's required checks; on GitLab "Pipelines must succeed" covers
576
581
  // every job, so the list there is for the docs only. `productVerified` is the Product's verified-commits
577
- // workflow, required when that file is there. Tests hold this equal to the templates' jobs and to the table
578
- // in docs/branch-protection.md.
582
+ // workflow, required when that file is there. On GitHub, pr-title and pr-template run from their own file
583
+ // (yad-pr-text.yml / yad-product-pr-text.yml, #425). Tests hold each list equal to the jobs of its templates
584
+ // and to the table in docs/branch-protection.md.
579
585
  export const REQUIRED_CHECKS = Object.freeze({
580
586
  github: Object.freeze({
581
587
  product: Object.freeze(['commit-message', 'pr-title', 'pr-template', 'ledger-guard', 'member-check']),
package/cli/openpr.mjs CHANGED
@@ -7,7 +7,7 @@ import fs from 'node:fs';
7
7
  import { c, log, ok, info, warn, hand, fail, run, exists, readJSON } from './lib.mjs';
8
8
  import { PROJECT_FILES , productConfigPath, settingsEditHint } from './manifest.mjs';
9
9
  import {
10
- detectPlatform, createPr, platformLogin, resolveBaseBranch, prNumberFromUrl,
10
+ detectPlatform, createPr, platformLogin, resolveBaseBranch, prNumberFromUrl, editPrBody, forkBranch, forkBranchWords, branchTaskId,
11
11
  } from './platform.mjs';
12
12
  import { taskFromBranch } from './commit.mjs';
13
13
  import { parseReviewBranch, artifactFromBase, gateCapFor, capLimit, peopleWord, gateRuleSum, gateRuleEnforced, legacyLogins } from './epic-state.mjs';
@@ -22,6 +22,7 @@ import { autoOpenCheck, recordAutoOpen, branchTasks, rangeTasks, groupWarnings }
22
22
  import { productDriftError } from './epic-state.mjs';
23
23
  import { err } from './errors.mjs';
24
24
  import { recordActor } from './skip.mjs';
25
+ import { previewLine, previewPattern, fillPattern, needs } from './preview.mjs';
25
26
 
26
27
  // Resolve the target code repo: --repo <name> from the registry, else --dir, else cwd. `product` (E80) is
27
28
  // the Product found from a code repo beside it: the registry is read there, and a repo run without
@@ -81,7 +82,7 @@ function codeTaskTemplate(platform) {
81
82
  }
82
83
  }
83
84
 
84
- export function templateBody(repoRoot, platform, { task, summary, risk, contract, domains, stage }) {
85
+ export function templateBody(repoRoot, platform, { task, summary, risk, contract, domains, stage, preview }) {
85
86
  // product-tooling: the Product's own template is artifact-review — use the bundled code-task template so the
86
87
  // body matches the shape the Product `pr-template` gate demands for a non-review head.
87
88
  let base;
@@ -100,7 +101,9 @@ export function templateBody(repoRoot, platform, { task, summary, risk, contract
100
101
  // Fill the obvious fields; leave the rest of the committed template intact for the author.
101
102
  // Function replacers (not string replacements) so a `$` in interpolated free text — a commit-derived
102
103
  // summary or a repo name — is inserted verbatim, never read as a `$1`/`$&` replacement token.
103
- let out = base
104
+ // The Preview line first, while the template is the only text: the summary, inserted below, is
105
+ // free text from the commit and may hold a `## Testing` of its own.
106
+ let out = (preview != null ? withPreviewLine(base, preview) : base)
104
107
  .replace(/EP-<slug>-S0N-T0N/g, () => task || 'EP-<slug>-S0N-T0N')
105
108
  .replace(/specs\/EP-<slug>-S0N\//g, () => `specs/${story || 'EP-<slug>-S0N'}/`)
106
109
  .replace(/(\*\*Risk level:\*\*)\s*\w+/i, (_m, g1) => `${g1} ${risk}`)
@@ -114,6 +117,24 @@ export function templateBody(repoRoot, platform, { task, summary, risk, contract
114
117
  return out;
115
118
  }
116
119
 
120
+ // The PR/MR description with its Preview line set (#359), looked for only in the `## Testing` section
121
+ // (the Summary, taken from the commit, may hold a line of its own that reads the same): the template's
122
+ // `**Preview:**` line there, else a line added at the top of that section (a template committed before
123
+ // #359). A template with no `## Testing` is the team's own shape and is left as it is.
124
+ export function withPreviewLine(body, preview) {
125
+ const eol = body.includes('\r\n') ? '\r\n' : '\n';
126
+ const head = /^## Testing[ \t]*\r?\n/m.exec(body);
127
+ if (!head) return body;
128
+ const start = head.index + head[0].length;
129
+ const next = body.slice(start).search(/^## /m);
130
+ const end = next < 0 ? body.length : start + next;
131
+ const section = body.slice(start, end);
132
+ const line = /^([-*][ \t]+)?(\*\*Preview:\*\*)[^\r\n]*/m;
133
+ if (line.test(section)) return body.slice(0, start) + section.replace(line, (_m, b, g) => `${b || ''}${g} ${preview}`) + body.slice(end);
134
+ const lead = /^(?:<!--[\s\S]*?-->[ \t]*\r?\n)?/.exec(section)[0];
135
+ return `${body.slice(0, start)}${lead}- **Preview:** ${preview}${eol}${section.slice(lead.length)}${body.slice(end)}`;
136
+ }
137
+
117
138
  // E66 — how many approvers this PR asks for, printed once it is open: the body's own level and contract
118
139
  // answer (what `--risk` / `--contract-change` put there), and the risk map on the BASE branch — a change
119
140
  // touching a `high` directory adds the high step. The largest step wins, so the map can raise what the
@@ -143,8 +164,8 @@ export function routeCount(repoRoot, baseBranch, opts = {}) {
143
164
  if (high.length && opts.risk !== 'high') lines.push([warn, `the body says Risk level: ${opts.risk || 'low'}, but the risk map on ${map.base} marks ${high.join(', ')} high — the larger counts`]);
144
165
  // E72 — the cap, SHOWN and never enforced here. The Build count never holds a merge: the platform's
145
166
  // branch protection does (Part 9), and the user decided (2026-09-21) that the Build half stays
146
- // reported even after E108 turns the Shape cap on. That is also E66's answer: the CI half of this count runs from the PR's own checkout of
147
- // `checks/`, so a PR can edit the script that counts it — harmless only because nothing blocks on it.
167
+ // reported even after E108 turns the Shape cap on. That is also E66's answer: CI runs the base branch's copy of the script
168
+ // that counts (#426), but the workflow calling it comes from the PR — harmless only because nothing blocks on it.
148
169
  // `gateRuleEnforced` is called WITHOUT the cap on purpose, so the line keeps saying "advisory".
149
170
  const cap = gateCapFor(rule, opts.active);
150
171
  const capped = cap?.capped ? `, capped to ${cap.to} for ${cap.active} active ${peopleWord(cap.active)}` : '';
@@ -347,6 +368,21 @@ export async function runOpenPr(root, opts = {}) {
347
368
  if (!fetched && auto) throw err('YAD-STATE-009', `could not fetch ${baseBranch} from origin, so the tasks ${branch} carries are not known`, 'check the network and your login, then run this again');
348
369
  if (!fetched) warn(`could not fetch ${baseBranch} from origin — the tasks this PR carries are read against the last fetched ${baseRef}`);
349
370
  const haveBase = run('git', ['rev-parse', '--verify', '--quiet', `${baseRef}^{commit}`], { cwd: repoRoot }).ok;
371
+ // A base nobody chose (the platform's default, origin/HEAD, or 'main') may not be where this branch was
372
+ // cut from (#450): then the range below holds another branch's commits. Stop before anything is pushed.
373
+ // A --base, or a default_branch someone set in repos.json or the Product settings, is trusted as it is.
374
+ if (haveBase && !['flag', 'registry', 'product'].includes(baseSource)) {
375
+ const fork = forkBranch(repoRoot, { base: baseBranch, head: branch });
376
+ if (fork?.skipped) info(`origin has ${fork.skipped} branches, so yad did not check which one ${branch} was cut from — pass --base if it is not ${baseBranch}`);
377
+ else if (fork) {
378
+ const why = forkBranchWords(fork, baseBranch);
379
+ if (auto) throw err('YAD-STATE-009', why, 'a person picks the base and opens it with --base <branch>');
380
+ fail(why);
381
+ if (meta?.name) hand(`if tasks in ${meta.name} always go to one branch, set its default_branch in .sdlc/repos.json`);
382
+ process.exitCode = 1;
383
+ return;
384
+ }
385
+ }
350
386
  const commitIds = haveBase ? rangeTasks(repoRoot, `${baseRef}..HEAD`) : null;
351
387
  let groupIds = null;
352
388
  if (auto) {
@@ -360,7 +396,12 @@ export async function runOpenPr(root, opts = {}) {
360
396
  Object.assign(auto, { tasks, ...autoOpenCheck(auto.productRoot, { story: auto.story, tasks, repo: auto.repo }) });
361
397
  if (ids.length > 1) groupIds = ids;
362
398
  info(`opened on the standing approval: the checks of ${ids.join(', ')} passed, and the open-pr dial is auto`);
363
- } else if (commitIds && commitIds.length > 1) groupIds = commitIds;
399
+ } else if (commitIds && commitIds.length > 1) {
400
+ // The branch's own task first, so the body's Spec path is its story, not the newest commit's (#450).
401
+ const own = (branchTaskId(branch) || '').toLowerCase();
402
+ const at = commitIds.findIndex((t) => t.toLowerCase() === own);
403
+ groupIds = at > 0 ? [commitIds[at], ...commitIds.filter((_t, i) => i !== at)] : commitIds;
404
+ }
364
405
  if (groupIds) {
365
406
  info(`a grouped PR/MR: ${groupIds.join(', ')}`);
366
407
  const settings = readJSON(productConfigPath(opts.product || root), {}) || {};
@@ -389,9 +430,13 @@ export async function runOpenPr(root, opts = {}) {
389
430
  .join('\n')
390
431
  .trim();
391
432
  const summary = [subjectText, bodyText].filter(Boolean).join('\n\n') || undefined;
392
- const body = templateBody(repoRoot, platform, {
393
- task: bodyTask, summary, risk: opts.risk || 'low', contract: !!opts.contractChange, domains: meta?.name, stage,
394
- });
433
+ // The Preview line (#359), on a code task only: the repo's pattern filled now, or a note. A pattern
434
+ // that needs the PR number is filled once the PR exists (below).
435
+ const pp = stage === 'code-repo' ? previewPattern(meta) : {};
436
+ const preview = stage === 'code-repo' ? previewLine(meta, { branch }) : undefined;
437
+ if (pp.problems) warn(`this repo's preview_url pattern cannot be used: it ${pp.problems.join('; ')} — set it again with \`yad repo preview <repo> <pattern>\``);
438
+ const bodyOpts = { task: bodyTask, summary, risk: opts.risk || 'low', contract: !!opts.contractChange, domains: meta?.name, stage };
439
+ const body = templateBody(repoRoot, platform, { ...bodyOpts, preview });
395
440
 
396
441
  // Assignee = the committer: `@me` on GitHub (buildPrArgs sends it when no assignee is named, and `gh`
397
442
  // resolves it on the repo's own host), the login `glab` reports on GitLab. No reviewers are requested (E62): the roster that named them is gone. The team requests them
@@ -405,6 +450,21 @@ export async function runOpenPr(root, opts = {}) {
405
450
  const r = creator(platform, { title, body, base: baseBranch, head: branch, assignees, cwd: repoRoot });
406
451
  if (!r.ok) { fail(`could not open PR/MR — ${r.reason || 'unknown'}`); process.exitCode = 1; return; }
407
452
  ok(`opened ${r.url}`);
453
+ // A {pr} pattern can only be filled now the PR has a number: the description is edited once. The PR
454
+ // is open whatever happens here — a failed edit is said, never a failure.
455
+ const pat = pp.pattern || null;
456
+ if (pat && needs(pat, 'pr')) {
457
+ const n = Number(prNumberFromUrl(r.url)) || null;
458
+ const url = n ? fillPattern(pat, { pr: n, branch, repo: meta?.name }) : null;
459
+ // The same body, built again with the address: only the Preview line can differ.
460
+ const filled = url ? templateBody(repoRoot, platform, { ...bodyOpts, preview: `<${url}>` }) : null;
461
+ if (url && filled === body) info(`this repo's PR/MR template has no ## Testing section, so the preview address was not written: ${url}`);
462
+ else if (url) {
463
+ const edit = (opts.editBody || editPrBody)(platform, n, filled, { cwd: repoRoot });
464
+ if (edit?.ok) ok(`preview ${url}`);
465
+ else warn(`the PR/MR is open, but its Preview line could not be filled (${String(edit?.reason || 'unknown').split('\n')[0]}) — the preview should be at ${url}`);
466
+ } else warn('the PR/MR is open, but its number could not be read from the URL, so the Preview line was left unfilled (`yad review context --pr <n>` gives the address)');
467
+ }
408
468
  if (auto) {
409
469
  // The PR is open whatever happens next: a record that cannot be written is said, never a failure.
410
470
  try {
package/cli/plan.mjs CHANGED
@@ -762,6 +762,8 @@ export const PRODUCT_PROFILE_FIX = 'add `product` to its `case "$PROFILE" in` li
762
762
  // The Product's checks workflows, under the new name and the old (E123): an edited old one is kept, and runs.
763
763
  export const PRODUCT_CHECK_WORKFLOWS = Object.freeze([
764
764
  '.github/workflows/yad-product-checks.yml', '.gitlab/ci/yad-product-checks.yml',
765
+ // pr-title + pr-template moved here on GitHub (#425), with their `--no-renames` diff lines.
766
+ '.github/workflows/yad-product-pr-text.yml',
765
767
  '.github/workflows/yad-hub-checks.yml', '.gitlab/ci/yad-hub-checks.yml',
766
768
  ]);
767
769
  // Those of them on disk that pass `--profile product` to the gates.
package/cli/platform.mjs CHANGED
@@ -76,14 +76,14 @@ export function platformLogin(cwd, platform, { runner = run, env = process.env,
76
76
  const ghHost = platform === 'github'
77
77
  ? (host || hostFromGitUrl(runner('git', ['remote', 'get-url', 'origin'], { cwd }).stdout) || null)
78
78
  : null;
79
- const key = `${platform}\0${cwd}\0${ghHost || ''}`;
79
+ const key = `${platform}\0${cwd}\0${ghHost || host || ''}`;
80
80
  if (runner === run && loginCache.has(key)) return loginCache.get(key);
81
81
  let login = null;
82
82
  if (platform === 'github') {
83
83
  const r = runner('gh', ['api', ...(ghHost ? ['--hostname', ghHost] : []), 'user', '--jq', '.login'], { cwd, timeout: 10000 });
84
84
  if (r.ok) login = r.stdout.trim();
85
85
  } else {
86
- const r = runner('glab', ['api', 'user'], { cwd, timeout: 10000 });
86
+ const r = runner('glab', ['api', ...(host ? ['--hostname', host] : []), 'user'], { cwd, timeout: 10000 });
87
87
  if (r.ok) { try { login = String(JSON.parse(r.stdout).username || ''); } catch { /* not JSON — no login */ } }
88
88
  }
89
89
  if (!login || !LOGIN_RE.test(login)) login = null;
@@ -472,6 +472,72 @@ export function resolveBaseBranch(platform, {
472
472
  return { base: 'main', source: 'fallback', platformDefault };
473
473
  }
474
474
 
475
+ // The branch a task branch was really cut from, when it is not the base (#450). A branch cut from an
476
+ // integration branch (`develop`) and opened with no --base gets the platform default (`main`), and then
477
+ // `origin/main..HEAD` holds commits `develop` has that `main` lacks: other tasks' commits, read as this PR's
478
+ // tasks, its Spec path, its size. So, for each remote branch: the commits of `origin/<base>..<fork point>`
479
+ // (the fork point = merge-base of that branch and HEAD) are in the PR's range and came from that branch; the
480
+ // ones whose `Task:` line names ANOTHER task are the ones that matter. A commit with no `Task:` line, or with
481
+ // this task's own id, is not counted (a teammate's copy cut from this branch, when it was cut from the base,
482
+ // holds only those, and is never named).
483
+ // Git cannot always tell the integration branch from a teammate's copy of this branch, or from a release
484
+ // branch cut from develop earlier (reviews 2 and 3): every branch with any such commit is returned, newest
485
+ // fork point first (fewest commits from it to HEAD), ties by name, and the person picks — never one guess.
486
+ // Returns { branch, foreign, others }, { skipped: n } past FORK_REF_CAP remote branches, or null — none, or
487
+ // git could not tell. Left out up front: origin/HEAD, the base, the task branch's own pushed copy,
488
+ // task-shaped names (a branch cut FROM this one), and every branch that already holds HEAD.
489
+ export const FORK_REF_CAP = 200;
490
+ const TASK_SHAPED = /-S\d+-T\d+(?:-|$)/i;
491
+ const TASK_ID = /^EP-[a-z0-9-]+-S\d+-T\d+$/i;
492
+ // The task a branch carries, wherever its id sits in the name (`feat/team/EP-x-S01-T02-word`).
493
+ export function branchTaskId(branch = '') {
494
+ const m = String(branch).match(/(?:^|[/_-])(EP-[a-z0-9-]+?-S\d+-T\d+)(?=-|$)/i);
495
+ return m ? m[1] : null;
496
+ }
497
+ export function forkBranch(cwd, { base, head, runner = run } = {}) {
498
+ const g = (args) => runner('git', args, { cwd });
499
+ const baseRef = `origin/${base}`;
500
+ if (!g(['rev-parse', '--verify', '--quiet', `${baseRef}^{commit}`]).ok) return null;
501
+ // The full name, never `refname:short`: a short name can come out as `remotes/origin/x` when ambiguous.
502
+ const refs = g(['for-each-ref', '--format=%(refname)', '--no-contains', 'HEAD', 'refs/remotes/origin/']);
503
+ if (!refs.ok) return null;
504
+ const skip = new Set(['origin/HEAD', baseRef, `origin/${head}`]);
505
+ const cands = refs.stdout.split('\n').map((r) => r.replace(/^refs\/remotes\//, ''))
506
+ .filter((r) => r.startsWith('origin/') && !skip.has(r) && !TASK_SHAPED.test(r)).sort();
507
+ if (cands.length > FORK_REF_CAP) return { skipped: cands.length };
508
+ const own = (branchTaskId(head) || '').toLowerCase();
509
+ const found = [];
510
+ for (const cand of cands) {
511
+ const mb = g(['merge-base', cand, 'HEAD']);
512
+ if (!mb.ok || !mb.stdout) continue;
513
+ const log = g(['log', '--no-merges', '--format=%(trailers:key=Task,valueonly,separator=%x1e)%x00', `${baseRef}..${mb.stdout}`]);
514
+ if (!log.ok) return null;
515
+ const foreign = log.stdout.split('\0').map((x) => x.split('\x1e')[0].trim())
516
+ .filter((t) => TASK_ID.test(t) && t.toLowerCase() !== own).length;
517
+ if (!foreign) continue;
518
+ const toHead = g(['rev-list', '--count', `${mb.stdout}..HEAD`]);
519
+ if (!toHead.ok) return null;
520
+ found.push({ branch: cand.slice('origin/'.length), foreign, n: Number(toHead.stdout) });
521
+ }
522
+ if (!found.length) return null;
523
+ found.sort((x, y) => x.n - y.n || x.branch.localeCompare(y.branch));
524
+ return { branch: found[0].branch, foreign: found[0].foreign, others: found.slice(1).map((f) => f.branch) };
525
+ }
526
+
527
+ // The words both commands print for a forkBranch answer (#450): one sentence, and the two ways out.
528
+ // `yad open-pr --base` takes a branch name; `yad run checks --base` takes a ref, so it asks for origin/<name>.
529
+ export function forkBranchWords(fork, base, { ref = '', verb = 'open the PR/MR against' } = {}) {
530
+ const n = fork.foreign === 1 ? '1 commit' : `${fork.foreign} commits`;
531
+ const others = fork.others || [];
532
+ if (!others.length) {
533
+ return `this branch holds ${n} of other tasks from origin/${fork.branch} that origin/${base} does not have, so it was likely cut from origin/${fork.branch} — pass --base ${ref}${fork.branch}, or --base ${ref}${base} to ${verb} ${base} anyway`;
534
+ }
535
+ // Each name in the form this command's --base takes, so one can be copied as it is (review 4).
536
+ const all = [fork.branch, ...others].slice(0, 5).map((b) => `${ref}${b}`);
537
+ const more = others.length + 1 > 5 ? ` (and ${others.length + 1 - 5} more)` : '';
538
+ return `this branch holds commits of other tasks that origin/${base} does not have (${n} from origin/${fork.branch}), so it was cut from another branch — pass the one it was cut from as --base: ${all.join(', ')}${more}; or --base ${ref}${base} to ${verb} ${base} anyway`;
539
+ }
540
+
475
541
  // ---- create a PR/MR -----------------------------------------------------------------------------
476
542
  // `assignees` = the committer/PR-opener on GitLab (empty when `glab` cannot say who is logged in);
477
543
  // GitHub callers pass none and get `@me`, so the PR is owned by whoever pushed it;
@@ -669,3 +735,92 @@ export function issueUrl(platform, repo, { title = '', body = '', labels = [] }
669
735
  if (labels.length) q.set('labels', labels.join(','));
670
736
  return `https://github.com/${repo}/issues/new?${q.toString()}`;
671
737
  }
738
+
739
+ // ---- writes to a tracker item (E170) -----------------------------------------------------------------
740
+ // `t` is a `prTarget`: { platform, cli, host, repo }. Each returns the runner's result. `-f` sends the value as
741
+ // plain text, so a body starting with `@` is never read as a file name.
742
+ const itemAt = (t, number) => (t.platform === 'github' ? `repos/${t.repo}/issues/${number}` : `projects/${encodeURIComponent(t.repo)}/issues/${number}`);
743
+ const itemWrite = (t, method, at, fields, runner) => runner(t.cli, ['api', '--hostname', t.host, '-X', method, at, ...fields.flatMap((f) => ['-f', f])], { timeout: 30000 });
744
+
745
+ export function addItemLabels(t, number, labels, { runner = run } = {}) {
746
+ if (t.platform === 'github') return itemWrite(t, 'POST', `${itemAt(t, number)}/labels`, labels.map((l) => `labels[]=${l}`), runner);
747
+ if (labels.some((l) => l.includes(','))) return { ok: false, stderr: 'a GitLab label name with a comma cannot be sent' };
748
+ return itemWrite(t, 'PUT', itemAt(t, number), [`add_labels=${labels.join(',')}`], runner);
749
+ }
750
+
751
+ export function removeItemLabels(t, number, labels, { runner = run } = {}) {
752
+ if (t.platform === 'github') {
753
+ let last = { ok: true };
754
+ for (const l of labels) { const r = itemWrite(t, 'DELETE', `${itemAt(t, number)}/labels/${encodeURIComponent(l)}`, [], runner); if (!r.ok) last = r; }
755
+ return last;
756
+ }
757
+ if (labels.some((l) => l.includes(','))) return { ok: false, stderr: 'a GitLab label name with a comma cannot be sent' };
758
+ return itemWrite(t, 'PUT', itemAt(t, number), [`remove_labels=${labels.join(',')}`], runner);
759
+ }
760
+
761
+ export function commentOnItem(t, number, body, { runner = run } = {}) {
762
+ return itemWrite(t, 'POST', `${itemAt(t, number)}/${t.platform === 'github' ? 'comments' : 'notes'}`, [`body=${body}`], runner);
763
+ }
764
+
765
+ export function closeItem(t, number, { runner = run } = {}) {
766
+ return itemWrite(t, t.platform === 'github' ? 'PATCH' : 'PUT', itemAt(t, number), [t.platform === 'github' ? 'state=closed' : 'state_event=close'], runner);
767
+ }
768
+
769
+ // ---- filing findings (E172) --------------------------------------------------------------------------
770
+ // A number goes with `-F` so it is sent as a number. `confidential` exists on GitLab only.
771
+ export function createFinding(t, { title, body, labels, milestone = null, confidential = false }, { runner = run } = {}) {
772
+ if (t.platform === 'github') {
773
+ const fields = ['-f', `title=${title}`, '-f', `body=${body}`, ...labels.flatMap((l) => ['-f', `labels[]=${l}`]), ...(milestone !== null ? ['-F', `milestone=${milestone}`] : [])];
774
+ return runner('gh', ['api', '--hostname', t.host, '-X', 'POST', `repos/${t.repo}/issues`, ...fields], { timeout: 30000 });
775
+ }
776
+ const fields = ['-f', `title=${title}`, '-f', `description=${body}`, '-f', `labels=${labels.join(',')}`, ...(milestone !== null ? ['-F', `milestone_id=${milestone}`] : []), ...(confidential ? ['-F', 'confidential=true'] : [])];
777
+ return runner('glab', ['api', '--hostname', t.host, '-X', 'POST', `projects/${encodeURIComponent(t.repo)}/issues`, ...fields], { timeout: 30000 });
778
+ }
779
+
780
+ export function createMilestone(t, title, { runner = run } = {}) {
781
+ const at = t.platform === 'github' ? `repos/${t.repo}/milestones` : `projects/${encodeURIComponent(t.repo)}/milestones`;
782
+ return runner(t.cli, ['api', '--hostname', t.host, '-X', 'POST', at, '-f', `title=${title}`], { timeout: 30000 });
783
+ }
784
+
785
+ // A draft a person publishes or discards. GitHub needs an affected package; `other` fits an application.
786
+ export function createDraftAdvisory(t, { summary, description, severity, cwe }, { runner = run } = {}) {
787
+ return runner('gh', ['api', '--hostname', t.host, '-X', 'POST', `repos/${t.repo}/security-advisories`, '-f', `summary=${summary}`, '-f', `description=${description}`, '-f', `severity=${severity}`, '-f', `cwe_ids[]=${cwe}`, '-f', 'vulnerabilities[][package][ecosystem]=other'], { timeout: 30000 });
788
+ }
789
+
790
+ // ---- acting on an item when a person asks (E173) -------------------------------------------------------
791
+ // Each returns the runner's result. A GitLab list field cannot be sent through `glab api` (it refuses a
792
+ // bracketed field name), so GitLab takes one assignee by id.
793
+ export function newItem(t, { title, body, labels, assignee = null, confidential = false }, { runner = run } = {}) {
794
+ if (t.platform === 'github') {
795
+ const fields = ['-f', `title=${title}`, '-f', `body=${body}`, ...labels.flatMap((l) => ['-f', `labels[]=${l}`]), ...(assignee ? ['-f', `assignees[]=${assignee}`] : [])];
796
+ return runner('gh', ['api', '--hostname', t.host, '-X', 'POST', `repos/${t.repo}/issues`, ...fields], { timeout: 30000 });
797
+ }
798
+ const fields = ['-f', `title=${title}`, '-f', `description=${body}`, '-f', `labels=${labels.join(',')}`, ...(assignee ? ['-F', `assignee_id=${assignee}`] : []), ...(confidential ? ['-F', 'confidential=true'] : [])];
799
+ return runner('glab', ['api', '--hostname', t.host, '-X', 'POST', `projects/${encodeURIComponent(t.repo)}/issues`, ...fields], { timeout: 30000 });
800
+ }
801
+
802
+ // `fields` is a map of plain-text fields. GitHub's body is `body`, GitLab's `description`.
803
+ export function editItem(t, number, fields, { runner = run } = {}) {
804
+ const gh = t.platform === 'github';
805
+ return itemWrite(t, gh ? 'PATCH' : 'PUT', itemAt(t, number), Object.entries(fields).map(([k, v]) => `${k === 'body' && !gh ? 'description' : k}=${v}`), runner);
806
+ }
807
+
808
+ export function reopenItem(t, number, { runner = run } = {}) {
809
+ return itemWrite(t, t.platform === 'github' ? 'PATCH' : 'PUT', itemAt(t, number), [t.platform === 'github' ? 'state=open' : 'state_event=reopen'], runner);
810
+ }
811
+
812
+ // GitHub: PATCH with one login replaces every assignee; clearing removes the current ones by name.
813
+ // GitLab: one user id, or 0 to clear.
814
+ export function setAssignee(t, number, who, { current = [], runner = run } = {}) {
815
+ if (t.platform === 'github') {
816
+ if (who !== null) return itemWrite(t, 'PATCH', itemAt(t, number), [`assignees[]=${who}`], runner);
817
+ if (!current.length) return { ok: true, code: 0, stdout: '{}', stderr: '' };
818
+ return itemWrite(t, 'DELETE', `${itemAt(t, number)}/assignees`, current.map((l) => `assignees[]=${l}`), runner);
819
+ }
820
+ return runner('glab', ['api', '--hostname', t.host, '-X', 'PUT', itemAt(t, number), '-F', `assignee_id=${who ?? 0}`], { timeout: 30000 });
821
+ }
822
+
823
+ // GitLab only: make an item confidential before it is marked as a vulnerability.
824
+ export function makeConfidential(t, number, { runner = run } = {}) {
825
+ return runner('glab', ['api', '--hostname', t.host, '-X', 'PUT', itemAt(t, number), '-F', 'confidential=true'], { timeout: 30000 });
826
+ }