yadflow 4.6.0 → 4.8.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.
- package/CHANGELOG.md +259 -0
- package/README.md +46 -4
- package/bin/commands.mjs +9 -2
- package/bin/yad.mjs +309 -30
- package/cli/agent-guard.mjs +511 -0
- package/cli/agent-guide.mjs +83 -0
- package/cli/agent-rules.mjs +381 -0
- package/cli/argv-flags.mjs +7 -0
- package/cli/artifact-status.mjs +88 -20
- package/cli/build.mjs +1372 -0
- package/cli/checkpoint.mjs +2 -2
- package/cli/ci-check.mjs +492 -0
- package/cli/commit.mjs +1 -0
- package/cli/dial.mjs +21 -1
- package/cli/docs.mjs +7 -2
- package/cli/doctor.mjs +176 -33
- package/cli/epic-state.mjs +360 -12
- package/cli/errors.mjs +3 -0
- package/cli/find-product.mjs +36 -2
- package/cli/fold.mjs +9 -5
- package/cli/gate-local.mjs +9 -1
- package/cli/gate.mjs +364 -22
- package/cli/guide.mjs +549 -0
- package/cli/history.mjs +22 -2
- package/cli/hook.mjs +35 -4
- package/cli/index-command.mjs +2 -2
- package/cli/ledger.mjs +60 -0
- package/cli/lib.mjs +46 -0
- package/cli/lifecycle/defaults/2.json +124 -0
- package/cli/lifecycle/lifecycle.schema.json +5 -2
- package/cli/lifecycle.mjs +16 -3
- package/cli/manifest.mjs +75 -0
- package/cli/marked-block.mjs +48 -0
- package/cli/members.mjs +19 -5
- package/cli/migrate.mjs +17 -19
- package/cli/next.mjs +35 -12
- package/cli/openpr.mjs +81 -5
- package/cli/plan.mjs +326 -22
- package/cli/platform.mjs +21 -0
- package/cli/pr-list.mjs +5 -3
- package/cli/product-index.mjs +6 -3
- package/cli/product-token.mjs +186 -0
- package/cli/productcommit.mjs +33 -0
- package/cli/protection.mjs +50 -0
- package/cli/recommend.mjs +3 -1
- package/cli/reconcile.mjs +187 -26
- package/cli/repo-publish.mjs +2 -2
- package/cli/report.mjs +62 -14
- package/cli/run-checks.mjs +586 -0
- package/cli/setup.mjs +244 -25
- package/cli/ship-drift.mjs +49 -18
- package/cli/signing.mjs +377 -0
- package/cli/standup.mjs +1 -1
- package/cli/status.mjs +282 -0
- package/cli/test-agents-file.mjs +993 -0
- package/cli/test-build.mjs +1559 -0
- package/cli/test-ci-check.mjs +616 -0
- package/cli/test-guide.mjs +1267 -0
- package/cli/test-node.mjs +129 -0
- package/cli/test-run-checks.mjs +603 -0
- package/cli/test-setup-agent.mjs +352 -0
- package/cli/test-signing.mjs +524 -0
- package/cli/test-worktree.mjs +520 -0
- package/cli/thread.mjs +4 -0
- package/cli/tidy.mjs +2 -2
- package/cli/toolbox.mjs +37 -6
- package/cli/update-commit.mjs +313 -11
- package/cli/workspace.mjs +38 -10
- package/cli/worktree-record.mjs +53 -0
- package/cli/worktree.mjs +379 -0
- package/package.json +6 -4
- package/skills/sdlc/config.yaml +5 -5
- package/skills/sdlc/module-help.csv +2 -1
- package/skills/yad-backfill/templates/checks/backfill-check.sh +9 -9
- package/skills/yad-change/SKILL.md +5 -1
- package/skills/yad-checks/SKILL.md +61 -12
- package/skills/yad-checks/references/check-gates.md +78 -14
- package/skills/yad-checks/templates/checks/build-test-lint.sh +22 -3
- package/skills/yad-checks/templates/checks/commit-message.sh +8 -2
- package/skills/yad-checks/templates/checks/contract-check.sh +61 -33
- package/skills/yad-checks/templates/checks/epic-open.sh +87 -14
- package/skills/yad-checks/templates/checks/ledger-guard.sh +3 -3
- package/skills/yad-checks/templates/checks/lineage-check.sh +88 -15
- package/skills/yad-checks/templates/checks/member-check.mjs +206 -35
- package/skills/yad-checks/templates/checks/package-manager.sh +42 -5
- package/skills/yad-checks/templates/checks/product-checkout.sh +161 -13
- package/skills/yad-checks/templates/checks/reconcile-debt-check.sh +94 -15
- package/skills/yad-checks/templates/checks/risk-map-check.sh +2 -2
- package/skills/yad-checks/templates/checks/spec-link.sh +63 -4
- package/skills/yad-checks/templates/checks/verified-commits.sh +23 -5
- package/skills/yad-checks/templates/github/yad-checks.yml +9 -9
- package/skills/yad-checks/templates/gitlab/.gitlab-ci.yml +4 -1
- package/skills/yad-checks/templates/gitlab/yad-checks.gitlab-ci.yml +5 -5
- package/skills/yad-checks/templates/gitlab/yad-product-checks.gitlab-ci.yml +16 -3
- package/skills/yad-checks/templates/gitlab/yad-update-guard.gitlab-ci.yml +5 -1
- package/skills/yad-checks/templates/gitlab/yad-verified-commits.gitlab-ci.yml +5 -1
- package/skills/yad-checks/templates/hooks/agent-guard.mjs +116 -0
- package/skills/yad-commit/SKILL.md +8 -5
- package/skills/yad-connect-repos/SKILL.md +5 -3
- package/skills/yad-connect-repos/references/code-context.md +2 -1
- package/skills/yad-connect-repos/references/repos-registry.md +2 -1
- package/skills/yad-docs/templates/app/package-lock.json +395 -106
- package/skills/yad-docs/templates/app/package.json +2 -2
- package/skills/yad-docs-overview/references/pipeline-model.md +2 -2
- package/skills/yad-engineer-review/SKILL.md +55 -25
- package/skills/yad-engineer-review/references/ship-and-record.md +49 -12
- package/skills/yad-epic/SKILL.md +2 -1
- package/skills/yad-epic/references/state-schema.md +76 -17
- package/skills/yad-guide/SKILL.md +192 -0
- package/skills/yad-implement/SKILL.md +75 -13
- package/skills/yad-implement/references/implement-conventions.md +8 -1
- package/skills/yad-implement/templates/.gitmessage +3 -0
- package/skills/yad-open-pr/SKILL.md +21 -0
- package/skills/yad-pair-review/SKILL.md +14 -5
- package/skills/yad-pr-template/SKILL.md +6 -2
- package/skills/yad-pr-template/templates/checks/pr-template.sh +85 -4
- package/skills/yad-pr-template/templates/checks/pr-title.sh +1 -1
- package/skills/yad-pr-template/templates/github/pull_request_template.md +1 -1
- package/skills/yad-pr-template/templates/gitlab/merge_request_templates/Default.md +1 -1
- package/skills/yad-product-bridge/SKILL.md +44 -12
- package/skills/yad-product-bridge/references/bridge.md +11 -5
- package/skills/yad-product-bridge/templates/github/yad-gate-sync.yml +2 -2
- package/skills/yad-product-bridge/templates/gitlab/yad-gate-sync.gitlab-ci.yml +9 -4
- package/skills/yad-reconcile/SKILL.md +9 -3
- package/skills/yad-report/SKILL.md +15 -0
- package/skills/yad-review-companion/SKILL.md +5 -3
- package/skills/yad-review-gate/SKILL.md +16 -8
- package/skills/yad-review-gate/references/gating.md +26 -1
- package/skills/yad-run/SKILL.md +61 -33
- package/skills/yad-run/references/run-loop.md +44 -22
- package/skills/yad-spec/SKILL.md +137 -16
- package/skills/yad-spec/references/spec-handoff.md +50 -3
- package/skills/yad-status/SKILL.md +7 -0
- package/skills/yad-stories/references/story-schema.md +1 -1
- package/skills/yad-sync-repos/SKILL.md +2 -1
- package/skills/yad-ui/SKILL.md +2 -2
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// E161: which Node line yadflow runs on. Below 18 it does not run (YAD-ENV-003); 18 and 20 are end of life —
|
|
2
|
+
// yadflow 4 still runs on them, with a warning (YAD-ENV-004), and yadflow 5 needs 22; 22 and later are ok.
|
|
3
|
+
// Also: the CI files yad installs in people's repos name no end-of-life Node.
|
|
4
|
+
import { test } from 'node:test';
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
|
|
12
|
+
if (process.env.NODE_TEST_CONTEXT) {
|
|
13
|
+
const write = process.stdout.write;
|
|
14
|
+
for (const k of ['log', 'info']) {
|
|
15
|
+
const orig = console[k];
|
|
16
|
+
console[k] = (...a) => (process.stdout.write === write ? console.error(...a) : orig(...a));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
process.env.YAD_NO_UPDATE_NOTIFIER = '1';
|
|
20
|
+
|
|
21
|
+
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
22
|
+
const { nodeSupport, nodeEndOfLife, cpMerge } = await import('./lib.mjs');
|
|
23
|
+
const { envChecks } = await import('./doctor.mjs');
|
|
24
|
+
const { CODES } = await import('./errors.mjs');
|
|
25
|
+
|
|
26
|
+
test('E161: nodeSupport reads the major version into three bands', () => {
|
|
27
|
+
for (const v of ['16.20.2', '17.0.0', 'v16.1.0', 'not-a-version']) assert.equal(nodeSupport(v), 'unsupported', v);
|
|
28
|
+
for (const v of ['18.20.4', '20.19.5', 'v20.0.0', '21.7.3']) assert.equal(nodeSupport(v), 'end-of-life', v);
|
|
29
|
+
for (const v of ['22.0.0', '22.22.2', '24.22.1', '25.1.0']) assert.equal(nodeSupport(v), 'ok', v);
|
|
30
|
+
assert.match(nodeEndOfLife('20.19.5'), /^Node 20\.19\.5 is end of life and gets no security fixes\. yadflow 4 still runs on it; yadflow 5 will need Node 22 or newer\./);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('E161: yad doctor\'s node row — fail below 18, warn on 18 to 21 (YAD-ENV-004), ok from 22', () => {
|
|
34
|
+
const row = (nodeVersion) => { const checks = []; envChecks(checks, { nodeVersion }); return checks.find((x) => x.id === 'node'); };
|
|
35
|
+
assert.equal(row('16.0.0').status, 'fail');
|
|
36
|
+
assert.match(row('16.0.0').message, /YAD-ENV-003/);
|
|
37
|
+
const old = row('20.19.5');
|
|
38
|
+
assert.equal(old.status, 'warn');
|
|
39
|
+
assert.match(old.message, /end of life.*YAD-ENV-004/);
|
|
40
|
+
assert.match(old.hint, /22 or newer/);
|
|
41
|
+
assert.equal(row('24.22.1').status, 'ok');
|
|
42
|
+
assert.ok(CODES['YAD-ENV-004'], 'the code is in the catalogue');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('E161: the CLI warns once on an end-of-life Node, on stderr only, and never under `hook`', () => {
|
|
46
|
+
const T = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'yad-node-')));
|
|
47
|
+
try {
|
|
48
|
+
const yad = (args, version) => spawnSync(process.execPath, [path.join(ROOT, 'bin/yad.mjs'), ...args], {
|
|
49
|
+
cwd: T, encoding: 'utf8', input: '{}',
|
|
50
|
+
env: { ...process.env, NO_COLOR: '1', YAD_PLATFORM_READ: '0', ...(version ? { YAD_TEST_NODE_VERSION: version } : {}) },
|
|
51
|
+
});
|
|
52
|
+
const old = yad(['detect', '--json'], '20.19.5');
|
|
53
|
+
assert.equal((old.stderr.match(/is end of life/g) || []).length, 1, old.stderr);
|
|
54
|
+
assert.doesNotMatch(old.stdout, /end of life/, 'stdout stays clean JSON');
|
|
55
|
+
JSON.parse(old.stdout);
|
|
56
|
+
assert.doesNotMatch(yad(['detect', '--json'], '24.22.1').stderr, /end of life/);
|
|
57
|
+
// The running Node, with no stand-in: on the CI legs for 18 and 20 it warns, on 22 and later it does not.
|
|
58
|
+
const real = yad(['detect', '--json']).stderr;
|
|
59
|
+
if (nodeSupport() === 'end-of-life') assert.match(real, /is end of life/, 'this Node is end of life');
|
|
60
|
+
else assert.doesNotMatch(real, /end of life/, 'this Node (22 or later) gets no warning');
|
|
61
|
+
assert.doesNotMatch(yad(['hook', 'agent-guard'], '20.19.5').stderr, /end of life/, 'a hook\'s stderr reaches the model');
|
|
62
|
+
} finally { fs.rmSync(T, { recursive: true, force: true }); }
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('E161: no CI file yad installs or generates names an end-of-life Node', () => {
|
|
66
|
+
const files = [
|
|
67
|
+
...['skills/yad-checks/templates', 'skills/yad-product-bridge/templates', 'skills/yad-pr-template/templates'].flatMap((d) => fs.readdirSync(path.join(ROOT, d), { recursive: true }).map((f) => path.join(d, f))),
|
|
68
|
+
'cli/docs.mjs',
|
|
69
|
+
].filter((f) => fs.statSync(path.join(ROOT, f)).isFile());
|
|
70
|
+
for (const f of files) {
|
|
71
|
+
const text = fs.readFileSync(path.join(ROOT, f), 'utf8');
|
|
72
|
+
assert.doesNotMatch(text, /node-version:\s*["']?(1[0-9]|20)["']?\s*$/m, f);
|
|
73
|
+
assert.doesNotMatch(text, /image:\s*node:(1[0-9]|20)\b/, f);
|
|
74
|
+
assert.doesNotMatch(text, /YAD_NODE_VERSION[^\n]*["'](1[0-9]|20)["']/, f);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('E161: cpMerge joins folders and never replaces a file (Node 24\'s cpSync refuses an existing folder)', () => {
|
|
79
|
+
const T = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'yad-cp-')));
|
|
80
|
+
try {
|
|
81
|
+
fs.mkdirSync(path.join(T, 'a/sub'), { recursive: true });
|
|
82
|
+
fs.writeFileSync(path.join(T, 'a/f.txt'), 'x');
|
|
83
|
+
fs.writeFileSync(path.join(T, 'a/sub/g.txt'), 'y');
|
|
84
|
+
fs.mkdirSync(path.join(T, 'b/sub'), { recursive: true });
|
|
85
|
+
fs.writeFileSync(path.join(T, 'b/keep.txt'), 'mine');
|
|
86
|
+
cpMerge(path.join(T, 'a'), path.join(T, 'b'));
|
|
87
|
+
assert.equal(fs.readFileSync(path.join(T, 'b/sub/g.txt'), 'utf8'), 'y');
|
|
88
|
+
assert.equal(fs.readFileSync(path.join(T, 'b/keep.txt'), 'utf8'), 'mine', 'the folder\'s own files are kept');
|
|
89
|
+
assert.throws(() => cpMerge(path.join(T, 'a'), path.join(T, 'b')), /EEXIST/, 'a file already there is never replaced');
|
|
90
|
+
assert.equal(fs.readFileSync(path.join(T, 'b/f.txt'), 'utf8'), 'x');
|
|
91
|
+
// A new folder keeps its source's permissions; a file keeps its mode; a link stays the link it is.
|
|
92
|
+
if (process.platform !== 'win32') {
|
|
93
|
+
fs.mkdirSync(path.join(T, 'p/private'), { recursive: true, mode: 0o700 });
|
|
94
|
+
fs.chmodSync(path.join(T, 'p/private'), 0o700);
|
|
95
|
+
fs.writeFileSync(path.join(T, 'p/run.sh'), '#!/bin/sh\n', { mode: 0o755 });
|
|
96
|
+
fs.symlinkSync('run.sh', path.join(T, 'p/link'));
|
|
97
|
+
const made = [];
|
|
98
|
+
cpMerge(path.join(T, 'p'), path.join(T, 'q'), made);
|
|
99
|
+
assert.equal(fs.statSync(path.join(T, 'q/private')).mode & 0o777, 0o700);
|
|
100
|
+
assert.equal(fs.statSync(path.join(T, 'q/run.sh')).mode & 0o777, 0o755);
|
|
101
|
+
assert.equal(fs.readlinkSync(path.join(T, 'q/link')), 'run.sh', 'a relative link stays relative');
|
|
102
|
+
assert.deepEqual(made.map((p) => path.relative(T, p)).sort(), ['q', 'q/link', 'q/private', 'q/run.sh']);
|
|
103
|
+
// A read-only folder still takes its files, and is read-only after the copy.
|
|
104
|
+
fs.mkdirSync(path.join(T, 'ro/locked'), { recursive: true });
|
|
105
|
+
fs.writeFileSync(path.join(T, 'ro/locked/f.txt'), 'z');
|
|
106
|
+
fs.chmodSync(path.join(T, 'ro/locked'), 0o555);
|
|
107
|
+
try {
|
|
108
|
+
cpMerge(path.join(T, 'ro'), path.join(T, 'rw'));
|
|
109
|
+
assert.equal(fs.readFileSync(path.join(T, 'rw/locked/f.txt'), 'utf8'), 'z');
|
|
110
|
+
assert.equal(fs.statSync(path.join(T, 'rw/locked')).mode & 0o777, 0o555);
|
|
111
|
+
} finally {
|
|
112
|
+
for (const d of ['ro/locked', 'rw/locked']) if (fs.existsSync(path.join(T, d))) fs.chmodSync(path.join(T, d), 0o755);
|
|
113
|
+
}
|
|
114
|
+
// A named pipe is refused, never read (copying one would wait forever).
|
|
115
|
+
fs.mkdirSync(path.join(T, 'r'));
|
|
116
|
+
spawnSync('mkfifo', [path.join(T, 'r/pipe')]);
|
|
117
|
+
if (fs.existsSync(path.join(T, 'r/pipe'))) assert.throws(() => cpMerge(path.join(T, 'r'), path.join(T, 's')), /not a file, a folder or a link/);
|
|
118
|
+
}
|
|
119
|
+
} finally { fs.rmSync(T, { recursive: true, force: true }); }
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('E161: the error catalogue, docs/CLI.md and the docs site list the same YAD-ENV codes', () => {
|
|
123
|
+
const env = Object.keys(CODES).filter((k) => k.startsWith('YAD-ENV-')).sort();
|
|
124
|
+
const cli = [...fs.readFileSync(path.join(ROOT, 'docs/CLI.md'), 'utf8').matchAll(/^\| `(YAD-ENV-\d+)` \|/gm)].map((m) => m[1]).sort();
|
|
125
|
+
const site = [...fs.readFileSync(path.join(ROOT, 'docs/sdlc-site/src/data/referenceData.ts'), 'utf8').matchAll(/code: '(YAD-ENV-\d+)'/g)].map((m) => m[1]).sort();
|
|
126
|
+
assert.deepEqual(cli, env);
|
|
127
|
+
assert.deepEqual(site, env);
|
|
128
|
+
});
|
|
129
|
+
|