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
package/cli/repo-publish.mjs
CHANGED
|
@@ -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
|
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
|
|
122
|
-
lines.push(
|
|
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
|
-
|
|
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`);
|