yadflow 3.8.0 → 3.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.
package/CHANGELOG.md CHANGED
@@ -1,14 +1,14 @@
1
- # [3.8.0](https://github.com/abdelrahmannasr/yadflow/compare/v3.7.1...v3.8.0) (2026-07-05)
1
+ # [3.9.0](https://github.com/abdelrahmannasr/yadflow/compare/v3.8.1...v3.9.0) (2026-07-05)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **cli:** address CodeRabbit review on yad update --push ([1b1b2f5](https://github.com/abdelrahmannasr/yadflow/commit/1b1b2f59ebda541acd8775a5af3f1c8044efcb57))
6
+ * **cli:** retry the publish push when the index is unchanged; note the registry in docs ([55209c0](https://github.com/abdelrahmannasr/yadflow/commit/55209c01e50e3a635e7311acd1ad10e8c61c5534))
7
7
 
8
8
 
9
9
  ### Features
10
10
 
11
- * **cli:** commit + push applied updates to the default branch (yad update --push) ([fa851c8](https://github.com/abdelrahmannasr/yadflow/commit/fa851c8784765d78df2fef153424ff9d46363731))
11
+ * **cli:** add `yad repo refresh --push` to publish code-map refresh to the hub ([0e3697d](https://github.com/abdelrahmannasr/yadflow/commit/0e3697d0be4ec5d11c300be9b02e04468f07ba8c))
12
12
 
13
13
  # [2.2.0](https://github.com/abdelrahmannasr/yadflow/compare/v2.1.0...v2.2.0) (2026-06-14)
14
14
 
package/bin/yad.mjs CHANGED
@@ -103,7 +103,9 @@ ${c.bold('Build helpers')}
103
103
  yad review nudge --repo <r> --pr <n> Friendly @-mention on a bare code-PR approve
104
104
  yad review reconcile --epic <id> --repo <r> --pr <n> Bridge: stamp engagement onto the build-log ship
105
105
  yad repo list Show connected repos (fresh / stale)
106
- yad repo refresh [name] Re-pack a stale repo (a human decision)
106
+ yad repo refresh [name] [--push] Re-pack a stale repo (a human decision). --push commits the
107
+ refreshed code-maps + registry as a chore(hub): sync code-context … [skip ci]
108
+ audit commit and pushes it to the hub default branch (--allow-branch to override)
107
109
 
108
110
  ${c.bold('Feature threads (post-lock change management)')}
109
111
  yad thread List every feature thread (genesis → changes → defects)
@@ -136,7 +138,7 @@ ${c.bold('Options')}
136
138
  --merged gate ci: merge phase — advance the step on the default branch
137
139
  --no-push gate ci: commit the ledger but do not push
138
140
  --push check --fix / update: commit + push applied changes to the default branch
139
- --allow-branch check --fix --push / update --push: allow committing on a non-default branch
141
+ --allow-branch check --fix --push / update --push / repo refresh --push: allow committing on a non-default branch
140
142
  -h, --help Show this help
141
143
  -v, --version Print version`;
142
144
 
@@ -289,7 +291,7 @@ async function main() {
289
291
  }
290
292
  case 'repo': {
291
293
  const [, action, name] = o._;
292
- await runRepo(o.dir, { action: action || 'list', name, today });
294
+ await runRepo(o.dir, { action: action || 'list', name, today, push: o.push, allowBranch: o.allowBranch });
293
295
  break;
294
296
  }
295
297
  case 'roster': {
package/cli/hubcommit.mjs CHANGED
@@ -2,10 +2,32 @@
2
2
  // `yad checkpoint` (sync new state) and `yad tidy up` (fold finished shards). Both must commit ONLY on
3
3
  // the default branch, so their `[skip ci]` commit never enters a PR's base..HEAD range (where it would
4
4
  // strand required checks and fail verified-commits). This module is the single home of that guard.
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
5
7
  import { warn, fail, hand, run } from './lib.mjs';
6
8
 
7
9
  export const hubGit = (root) => (...args) => run('git', args, { cwd: root });
8
10
 
11
+ const readFileSafe = (p) => { try { return fs.readFileSync(p, 'utf8'); } catch { return ''; } };
12
+
13
+ // A direct-to-default push (`yad update --push`, `yad repo refresh --push`) will be rejected by the
14
+ // yad-update-guard unless the commits are signed AND their author email is allowlisted. Warn up front
15
+ // (never block) so the operator isn't surprised by a reddened default branch. Best-effort, hub-identity
16
+ // based.
17
+ export function preflightGuardReadiness(root) {
18
+ const gitcfg = (k) => run('git', ['config', '--get', k], { cwd: root }).stdout;
19
+ // Only commit.gpgsign actually enables signing — user.signingkey merely picks WHICH key once
20
+ // signing is on, so it must not count (it would hide the warning while commits stay unsigned).
21
+ const signing = run('git', ['config', '--bool', '--get', 'commit.gpgsign'], { cwd: root }).stdout === 'true';
22
+ if (!signing) warn('commit signing is not enabled (git config commit.gpgsign true) — the yad-update-guard requires a platform-Verified signature; unsigned pushes will fail the gate.');
23
+ const email = gitcfg('user.email').toLowerCase();
24
+ const allow = readFileSafe(path.join(root, '.sdlc', 'verified-authors'));
25
+ const known = allow.split('\n').map((l) => l.trim().toLowerCase()).filter((l) => l && !l.startsWith('#'));
26
+ if (known.length && email && !known.includes(email)) {
27
+ warn(`your git email <${email}> is not in .sdlc/verified-authors — the yad-update-guard will reject these commits (add it to the hub roster and re-run \`yad check --fix\`).`);
28
+ }
29
+ }
30
+
9
31
  // The default branch: hub config, else the remote's published default (origin/HEAD), else 'main'.
10
32
  // NEVER the current branch — falling back to it (as gate.mjs does, safe there because CI checks out the
11
33
  // default branch) would make the guard below a no-op on a WIP branch and let an unsigned commit land in
package/cli/reconcile.mjs CHANGED
@@ -4,27 +4,12 @@
4
4
  import fs from 'node:fs';
5
5
  import path from 'node:path';
6
6
  import {
7
- c, log, ok, info, warn, hand, readJSON, writeJSON, exists, run,
7
+ c, log, ok, info, warn, hand, readJSON, writeJSON, exists,
8
8
  } from './lib.mjs';
9
9
 
10
10
  const readFileSafe = (p) => { try { return fs.readFileSync(p, 'utf8'); } catch { return ''; } };
11
11
 
12
- // The yad-update-guard will reject the very commits `--push` is about to create unless they are
13
- // signed AND their author email is allowlisted. Warn up front (never block) so the operator isn't
14
- // surprised by a reddened default branch across every repo. Best-effort, hub-identity based.
15
- function preflightGuardReadiness(root) {
16
- const gitcfg = (k) => run('git', ['config', '--get', k], { cwd: root }).stdout;
17
- // Only commit.gpgsign actually enables signing — user.signingkey merely picks WHICH key once
18
- // signing is on, so it must not count (it would hide the warning while commits stay unsigned).
19
- const signing = run('git', ['config', '--bool', '--get', 'commit.gpgsign'], { cwd: root }).stdout === 'true';
20
- if (!signing) warn('commit signing is not enabled (git config commit.gpgsign true) — the yad-update-guard requires a platform-Verified signature; unsigned pushes will fail the gate.');
21
- const email = gitcfg('user.email').toLowerCase();
22
- const allow = readFileSafe(path.join(root, '.sdlc', 'verified-authors'));
23
- const known = allow.split('\n').map((l) => l.trim().toLowerCase()).filter((l) => l && !l.startsWith('#'));
24
- if (known.length && email && !known.includes(email)) {
25
- warn(`your git email <${email}> is not in .sdlc/verified-authors — the yad-update-guard will reject these commits (add it to the hub roster and re-run \`yad check --fix\`).`);
26
- }
27
- }
12
+ import { preflightGuardReadiness } from './hubcommit.mjs';
28
13
  import { VERSION, PROJECT_FILES } from './manifest.mjs';
29
14
  import {
30
15
  moduleActions, repoActions, hubActions, authorsActions,
@@ -0,0 +1,145 @@
1
+ // `yad repo refresh --push` — after a repack + registry stamp, commit the connected-repo code-context
2
+ // (the tracked `code-map.md` per repo + the registry `.sdlc/repos.json`) and push it straight to the
3
+ // hub's default branch, so a code-map refresh "just lands" for teammates / CI / `yad status` on other
4
+ // machines instead of leaving a dirty tree for someone to hand-commit. This is the code-context
5
+ // analogue of `yad checkpoint` (cli/checkpoint.mjs) and reuses its default-branch commit machinery.
6
+ //
7
+ // Invariants (shared with checkpoint):
8
+ // 1. Stage an EXPLICIT allowlist — exactly the tracked code-maps + the registry (never `git add -A`,
9
+ // which would sweep unrelated work in the hub). The gitignored repomix pack.md is never staged.
10
+ // 2. Commit ONLY on the hub's default branch (unless --allow-branch), so the `[skip ci]` audit
11
+ // commit never enters a PR's base..HEAD range where it would strand required checks.
12
+ import fs from 'node:fs';
13
+ import path from 'node:path';
14
+ import { c, ok, info, fail, hand, exists, pushWithRebase } from './lib.mjs';
15
+ import { PROJECT_FILES } from './manifest.mjs';
16
+ import { loadHub } from './gate.mjs';
17
+ import { resolveCommitterLogin } from './platform.mjs';
18
+ import { hubGit, resolveDefaultBranch, guardDefaultBranch, preflightGuardReadiness } from './hubcommit.mjs';
19
+ import { checkpointAuthor } from './checkpoint.mjs';
20
+
21
+ // Collapse any whitespace/newline runs to a single space — keeps a hostile `git user.name` or a stray
22
+ // path from breaking the one-line subject or injecting a fake trailer line.
23
+ const oneLine = (s = '') => String(s).replace(/\s+/g, ' ').trim();
24
+
25
+ // The tracked code-map for a repo: the registered path, else the conventional location.
26
+ const codeMapOf = (repo) => repo.codeMap || path.posix.join('.sdlc/code-context', repo.name, 'code-map.md');
27
+
28
+ // PURE — the repo-relative pathspecs to stage: the registry plus each registered repo's code-map that
29
+ // exists on disk. When `name` is given (a scoped `yad repo refresh <name> --push`), only that repo's
30
+ // code-map is staged, so an unrelated repo's uncommitted code-map never rides along in a named refresh's
31
+ // audit commit. Explicit allowlist by design (invariant 1); the gitignored pack.md is never included.
32
+ export function codeMapPathspecs(root, registry = { repos: [] }, name = null) {
33
+ const out = [];
34
+ for (const repo of registry.repos || []) {
35
+ if (name && repo.name !== name) continue;
36
+ const rel = codeMapOf(repo);
37
+ if (fs.existsSync(path.join(root, rel))) out.push(rel);
38
+ }
39
+ // The registry always rides along — `yad repo refresh` stamps syncedHead/lastSyncedAt into it.
40
+ if (fs.existsSync(path.join(root, PROJECT_FILES.reposRegistry))) out.push(PROJECT_FILES.reposRegistry);
41
+ return out;
42
+ }
43
+
44
+ // PURE — turn the staged pathspecs into the subject `label` + the body's file list. A `<name>` is
45
+ // pulled from any `.sdlc/code-context/<name>/code-map.md` path; a commit that only touched the
46
+ // registry is labelled `registry`.
47
+ export function summarizeCodeContext(files = []) {
48
+ const repos = new Set();
49
+ const basenames = [];
50
+ for (const f of files) {
51
+ basenames.push(f);
52
+ const m = f.match(/\.sdlc\/code-context\/([^/]+)\/code-map\.md$/);
53
+ if (m) repos.add(m[1]);
54
+ }
55
+ let label;
56
+ if (repos.size === 1) label = [...repos][0];
57
+ else if (repos.size > 1) label = `${repos.size} repos`;
58
+ else label = 'registry';
59
+ return { label, basenames };
60
+ }
61
+
62
+ // PURE — the audit-trail commit message. Subject passes the hub commit-message gate (valid type
63
+ // `chore`, scope `hub`, non-empty description, no trailing period). No Task trailer and no
64
+ // Co-Authored-By: this is human-owned machine state, not an authored code change. `[skip ci]` mirrors
65
+ // `yad checkpoint` — it lands on the default branch and needs no PR gate suite. `label`/`author` are
66
+ // collapsed to one line so nothing can split the subject or forge a trailer.
67
+ export function buildCodeMapMessage({ label, author, basenames = [] }) {
68
+ const subject = `chore(hub): sync code-context — ${oneLine(label)} by ${oneLine(author)} [skip ci]`;
69
+ const body = basenames.length ? `Updated: ${basenames.join(', ')}` : '';
70
+ return body ? `${subject}\n\n${body}` : subject;
71
+ }
72
+
73
+ // Commit the tracked code-context (and, with push, push it) on the hub's default branch. Mirrors
74
+ // `runCheckpoint`. Never throws; sets process.exitCode on a hard error so the CLI reports failure.
75
+ export async function publishCodeContext(root, { push = false, allowBranch = false, name = null } = {}) {
76
+ if (!exists(path.join(root, '.git'))) { fail('not a git repo'); process.exitCode = 1; return; }
77
+ if (!exists(path.join(root, PROJECT_FILES.hubConfig))) {
78
+ fail('no .sdlc/hub.json — --push publishes the hub code-context; run it from the product hub');
79
+ process.exitCode = 1;
80
+ return;
81
+ }
82
+
83
+ const { hub, repos } = loadHub(root);
84
+ const registry = { repos: repos || [] };
85
+ const git = hubGit(root);
86
+
87
+ const branch = git('rev-parse', '--abbrev-ref', 'HEAD').stdout;
88
+ const defaultBranch = resolveDefaultBranch(git, hub);
89
+ if (!guardDefaultBranch(branch, defaultBranch, { allowBranch, cmd: 'yad repo refresh --push' })) return;
90
+
91
+ const pathspecs = codeMapPathspecs(root, registry, name);
92
+ if (!pathspecs.length) { info('no code-context to publish — nothing to commit'); return; }
93
+
94
+ const add = git('add', '--', ...pathspecs);
95
+ if (!add.ok) { fail(`git add failed — ${add.stderr.split('\n')[0] || add.code}`); process.exitCode = 1; return; }
96
+
97
+ // Push HEAD to its OWN branch — on the default branch this is the same; with --allow-branch it keeps a
98
+ // WIP branch from being force-published onto the default branch. Shared by the fresh-commit path and
99
+ // the retry-after-failed-push path below.
100
+ const pushHead = () => {
101
+ if (pushWithRebase(root, branch).ok) { ok(`pushed to origin/${branch}`); return true; }
102
+ fail(`could not push to origin/${branch} — a protected branch, or an unresolvable rebase conflict`);
103
+ hand(`run \`git pull --rebase\` and re-run \`yad repo refresh --push\``);
104
+ process.exitCode = 1;
105
+ return false;
106
+ };
107
+
108
+ if (git('diff', '--cached', '--quiet', '--', ...pathspecs).ok) {
109
+ // Nothing new to commit. A non-push run is simply done. But on a push run a PRIOR run may have
110
+ // committed and then FAILED to push (the commit sits ahead of origin) — a plain re-run must land
111
+ // that commit, not silently no-op and exit 0 while it stays stranded. Push any unpushed commit(s).
112
+ if (!push) { info('code-context unchanged — nothing to commit'); return; }
113
+ const rev = git('rev-list', '--count', `origin/${branch}..HEAD`);
114
+ const ahead = rev.ok ? (Number(rev.stdout) || 0) : 1; // no upstream ref yet -> attempt the push
115
+ if (!ahead) { info('code-context unchanged and already published — nothing to do'); return; }
116
+ info(`code-context unchanged — pushing ${ahead} already-committed change(s) not yet on origin/${branch}`);
117
+ pushHead();
118
+ return;
119
+ }
120
+ // The exact files staged from the allowlist — scopes the commit to ONLY the allowlist, so any
121
+ // unrelated pre-staged file never rides along.
122
+ const staged = git('diff', '--cached', '--name-only', '--', ...pathspecs).stdout.split('\n').filter(Boolean);
123
+
124
+ // Only relevant when we are about to push a commit straight to the default branch: warn (never block)
125
+ // if signing/allowlisting would make the yad-update-guard reject it. Gated on `push` and deferred to
126
+ // here so it isn't noise on a guard-refused branch or a nothing-to-commit run.
127
+ if (push) preflightGuardReadiness(root);
128
+
129
+ const { label, basenames } = summarizeCodeContext(staged);
130
+ const author = checkpointAuthor(resolveCommitterLogin(root, hub?.roster || []), git('config', 'user.name').stdout);
131
+ const message = buildCodeMapMessage({ label, author, basenames });
132
+
133
+ const cm = git('commit', '-m', message, '--', ...staged);
134
+ if (!cm.ok) {
135
+ git('reset', '-q', '--', ...pathspecs); // don't leave the allowlist staged for an unrelated commit to sweep up
136
+ fail(`git commit failed — ${cm.stderr.split('\n')[0] || cm.code}`);
137
+ process.exitCode = 1;
138
+ return { message };
139
+ }
140
+ ok(`published ${staged.length} file(s): ${c.dim(label)}`);
141
+
142
+ if (!push) return { message };
143
+ pushHead();
144
+ return { message };
145
+ }
package/cli/repo.mjs CHANGED
@@ -7,6 +7,7 @@ import path from 'node:path';
7
7
  import { c, log, ok, info, warn, hand, fail, readJSON, writeJSON, run } from './lib.mjs';
8
8
  import { PROJECT_FILES } from './manifest.mjs';
9
9
  import { gitHead, packRepo } from './setup.mjs';
10
+ import { publishCodeContext } from './repo-publish.mjs';
10
11
 
11
12
  function load(root) {
12
13
  const regPath = path.join(root, PROJECT_FILES.reposRegistry);
@@ -35,7 +36,7 @@ function defaultBranch(cwd, repo) {
35
36
  return r.ok && r.stdout ? r.stdout.replace(/^origin\//, '') : 'main';
36
37
  }
37
38
 
38
- export async function runRepo(root, { action = 'list', name, today } = {}) {
39
+ export async function runRepo(root, { action = 'list', name, today, push = false, allowBranch = false } = {}) {
39
40
  const { regPath, registry } = load(root);
40
41
  if (!registry.repos.length) { warn('no repos registered (.sdlc/repos.json) — run `yad setup`'); return { repos: 0 }; }
41
42
 
@@ -69,7 +70,16 @@ export async function runRepo(root, { action = 'list', name, today } = {}) {
69
70
  }
70
71
  writeJSON(regPath, registry);
71
72
  refreshed ? ok(`refreshed ${refreshed} repo(s)`) : info('nothing refreshed');
72
- hand('regenerate the code-map in Claude Code (yad-connect-repos) — the pack is cached, the map is the AI step');
73
+ if (push) {
74
+ // Publish whatever tracked code-context now differs (the AI-regenerated code-maps + the stamped
75
+ // registry) straight to the hub's default branch as one audit-trail commit. The pack itself is
76
+ // gitignored; the code-map is regenerated by the AI (yad-connect-repos) — run that first if a
77
+ // repo's map is stale, then `yad repo refresh --push` lands it.
78
+ await publishCodeContext(root, { push: true, allowBranch, name });
79
+ } else {
80
+ hand('regenerate the code-map in Claude Code (yad-connect-repos) — the pack is cached, the map is the AI step');
81
+ hand('then publish it to the hub default branch with `yad repo refresh --push`');
82
+ }
73
83
  return { refreshed };
74
84
  }
75
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yadflow",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "Yadflow — the gated, team, multi-repo SDLC: author → review → build with a PR-driven review gate and a zero-dependency `yad` CLI (setup, gate, commit, open-pr, ship, repo, thread, reconcile). A BMAD module + 38 yad-* skills.",
5
5
  "type": "module",
6
6
  "author": "AbdelRahman Nasr",
@@ -9,7 +9,7 @@ SDLC Workflow,yad-architecture,Author Architecture,AA,"Front state 3: with the a
9
9
  SDLC Workflow,yad-ui,Author UI Design,AU,"Front state 5: with the ux-designer author ui-design.md and DESIGN.md, driving Impeccable slash-commands when installed. Never auto-advances.",,{epic: EP-<slug>},1-front,yad-review-gate,yad-review-gate,true,epics/EP-<slug>/,ui-design.md DESIGN.md state.json
10
10
  SDLC Workflow,yad-stories,Author Stories,AS,"Front state 7: with the pm break the epic into repo-tagged stories with stable EP-<slug>-S0N IDs, one file each under stories/. Never auto-advances.",,{epic: EP-<slug>},1-front,yad-review-gate,yad-review-gate,true,epics/EP-<slug>/stories/,stories/EP-<slug>-S0N.md state.json
11
11
  SDLC Workflow,yad-test-cases,Author Test Cases,TC,"Front state 9 (PARALLEL, non-blocking): opens when the stories gate passes — the epic is already ready-for-build, so the build half can start at the same time the tester works here. With the test architect (Murat) author test-cases.md covering the approved stories, and — when a testing tool is connected (.sdlc/testing.json) — generate/link the actual automation tests in it, recording test-links.json; otherwise produce the test-case artifact only. Its review never moves currentStep off ready-for-build. Never auto-advances.",,{epic: EP-<slug>},1-front,yad-review-gate,yad-review-gate,true,epics/EP-<slug>/,test-cases.md test-links.json state.json
12
- SDLC Workflow,yad-connect-repos,Connect Code Repos,CR,"Setup/maintenance: connect code repos to the product hub so the front/brain phases are code-aware. Registers each repo (GitHub or GitLab, local-user auth, no stored tokens) in .sdlc/repos.json and caches a Repomix pack + a lightweight code-map (existing endpoints/events/data-models/modules, secret-scanned). Idempotent and refreshable; staleness tracked by HEAD sha. Run at setup or any time a new repo is added. Not a gated state — never touches epic state or approvals.",,{action: connect|refresh|list|disconnect} {repo: <name>} {path: <path-or-absolute>} {git_url: <ssh-or-https>} {domain_owner: <who>},0-setup,,yad-sync-repos,false,.sdlc/,repos.json code-context/<repo>/pack.md code-context/<repo>/code-map.md
12
+ SDLC Workflow,yad-connect-repos,Connect Code Repos,CR,"Setup/maintenance: connect code repos to the product hub so the front/brain phases are code-aware. Registers each repo (GitHub or GitLab, local-user auth, no stored tokens) in .sdlc/repos.json and caches a Repomix pack + a lightweight code-map (existing endpoints/events/data-models/modules, secret-scanned). Idempotent and refreshable; staleness tracked by HEAD sha. yad repo refresh --push publishes the refreshed code-maps + registry to the hub default branch as a chore(hub): sync code-context [skip ci] audit commit. Run at setup or any time a new repo is added. Not a gated state — never touches epic state or approvals.",,{action: connect|refresh|list|disconnect} {repo: <name>} {path: <path-or-absolute>} {git_url: <ssh-or-https>} {domain_owner: <who>},0-setup,,yad-sync-repos,false,.sdlc/,repos.json code-context/<repo>/pack.md code-context/<repo>/code-map.md
13
13
  SDLC Workflow,yad-sync-repos,Sync Connected Repos,SR,"Setup/maintenance: bring every connected repo up to date in one shot — switch each repo in .sdlc/repos.json to its default_branch and fast-forward it from origin (local-user git, no stored tokens). Working-tree only; never a gate and never writes the registry. A dirty repo is skipped and reported (never overwritten); a diverged branch is left for manual resolution (fast-forward only). After pulling, a repo's cached pack goes stale — points the human at yad repo refresh.",,{action: sync} {repo: <name>},0-setup,yad-connect-repos,yad-connect-design,false,,(none — working-tree only)
14
14
  SDLC Workflow,yad-connect-design,Connect Design Tool,CD,"Setup/maintenance: connect a design tool (Figma-first, pluggable) to the product hub so the UI design step can materialize the actual feature design (mobile screens / web pages) inside it, alongside ui-design.md + DESIGN.md. Records the tool + project/file references in .sdlc/design.json (local-user / MCP-session auth, no stored tokens), detecting whether a design-tool MCP is available and degrading to markdown-only when absent. Idempotent and refreshable; one connection per project. Not a gated state — never touches epic state or approvals.",,{action: connect|refresh|list|disconnect} {tool: figma|pencil|none} {project_url: <team/project/file url>} {files: {web,mobile}},0-setup,,yad-ui,false,.sdlc/,design.json
15
15
  SDLC Workflow,yad-connect-testing,Connect Testing Tool,CT,"Setup/maintenance: connect a testing tool (Playwright-first, pluggable) to the product hub so the test-cases step can implement the actual automation tests in it, alongside test-cases.md. Records the tool + project/suite references in .sdlc/testing.json (local-user / MCP-session auth, no stored tokens), detecting whether a testing-tool MCP is available and degrading to artifacts-only when absent. Idempotent and refreshable; one connection per project. Not a gated state — never touches epic state or approvals.",,{action: connect|refresh|list|disconnect} {tool: playwright|cypress|pytest|none} {project_url: <project/config reference>} {suites: {<repo>}},0-setup,,yad-test-cases,false,.sdlc/,testing.json
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: yad-connect-repos
3
- description: 'Connects code repos to the product hub so the front/"brain" phases are code-aware. Registers N code repos (GitHub or GitLab, local-user auth, no stored tokens) into the project-wide .sdlc/repos.json, then caches an AI-readable picture of each — a compressed Repomix pack and a lightweight code-map (existing endpoints/events/data-models/modules), secret-scanned. Run at one-time setup or any time a new repo is added. Reusable, idempotent, refreshable; staleness is tracked by HEAD sha. Use when the user says "connect a repo", "connect the code repos", "refresh the code context", or "list connected repos".'
3
+ description: 'Connects code repos to the product hub so the front/"brain" phases are code-aware. Registers N code repos (GitHub or GitLab, local-user auth, no stored tokens) into the project-wide .sdlc/repos.json, then caches an AI-readable picture of each — a compressed Repomix pack and a lightweight code-map (existing endpoints/events/data-models/modules), secret-scanned. Run at one-time setup or any time a new repo is added. Reusable, idempotent, refreshable; staleness is tracked by HEAD sha. `yad repo refresh --push` publishes the refreshed code-maps + registry to the hub default branch as a chore(hub): sync code-context [skip ci] audit commit. Use when the user says "connect a repo", "connect the code repos", "refresh the code context", "list connected repos", or "push the code-map refresh".'
4
4
  ---
5
5
 
6
6
  # SDLC — Connect Code Repos (make the brain code-aware)
@@ -109,7 +109,13 @@ the front phases will now load this repo's code-map. Nothing auto-advances; this
109
109
  ## Other actions
110
110
 
111
111
  - **`refresh`** — re-run Steps 2–4 for an already-connected repo (after its code moves). Updates
112
- `syncedHead` + `lastSyncedAt`. Same machinery as `connect`.
112
+ `syncedHead` + `lastSyncedAt`. Same machinery as `connect`. Once the AI has regenerated the
113
+ `code-map.md` (Step 3), publish it to the product hub with **`yad repo refresh <repo> --push`**: it
114
+ commits the tracked code-maps + `.sdlc/repos.json` (never the gitignored `pack.md`) as one
115
+ audit-trail commit `chore(hub): sync code-context — <repos> by @<login> [skip ci]` and pushes it
116
+ straight to the hub's **default branch** (add `--allow-branch` to commit on a non-default branch).
117
+ This is the code-context analogue of `yad checkpoint` — human-owned machine state, no Task trailer,
118
+ no Co-Authored-By.
113
119
  - **`list`** — print every registry entry with a **fresh/stale** flag: compare each repo's current HEAD
114
120
  (`git -C <path> rev-parse HEAD`) to its `syncedHead`; differ ⇒ **stale** (suggest `refresh`).
115
121
  - **`disconnect`** — remove the repo from the registry and delete its cache dir. Leaves the **code repo
@@ -80,7 +80,9 @@ This is for a one-off look at a specific area. **Staleness is a human decision,
80
80
  side-effect:** when a repo is stale (HEAD ≠ `syncedHead`), the phase **flags it and stops** —
81
81
  "`<repo>` is stale; run `yad repo refresh <repo>` to re-pack the cache + `syncedHead`" — rather than
82
82
  silently re-packing the whole repo. A phase never refreshes the registry on its own; the human runs
83
- `yad repo refresh` (or `yad check --fix`).
83
+ `yad repo refresh` (or `yad check --fix`). After the AI regenerates the code-map, `yad repo refresh
84
+ --push` publishes the refreshed code-maps + registry to the hub's default branch as a `chore(hub): sync
85
+ code-context … [skip ci]` audit commit (never `pack.md`; `--allow-branch` overrides the branch guard).
84
86
 
85
87
  ## Why this stays DRY with backfill
86
88
 
@@ -52,6 +52,8 @@ not under any `epics/EP-<slug>/.sdlc/`.
52
52
 
53
53
  Commit the **registry** (`repos.json`) and each repo's **`code-map.md`** — they are small, reviewable,
54
54
  and are what the front phases actually read (a diff on a code-map shows when a repo's surface moved).
55
+ `yad repo refresh --push` commits and pushes exactly these (never `pack.md`) to the hub's default
56
+ branch as one `chore(hub): sync code-context … [skip ci]` audit commit.
55
57
  **Ignore** the full Repomix `pack.md` — it is large and regenerable (`action: refresh`). The product
56
58
  hub's `.gitignore` carries `.sdlc/code-context/*/pack.md` for this. This mirrors how the per-epic
57
59
  `.sdlc/` state (state.json, approvals.json, build-log.json) is committed.
@@ -55,6 +55,11 @@ yad-gate-sync:
55
55
  # Pinned glab binary (node:20 has no glab). Alternative: image registry.gitlab.com/gitlab-org/cli.
56
56
  - GLAB_VERSION=1.55.0
57
57
  - curl -fsSL "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_amd64.deb" -o /tmp/glab.deb && dpkg -i /tmp/glab.deb
58
+ # Pinned jq binary (node:20 has none, and `glab api` has NO built-in --jq like `gh api` does —
59
+ # it errors "unknown flag: --jq"). We fetch raw JSON from glab and filter it through real jq;
60
+ # jq streams glab's concatenated per-page --paginate arrays natively.
61
+ - JQ_VERSION=1.7.1
62
+ - curl -fsSL "https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux-amd64" -o /usr/local/bin/jq && chmod +x /usr/local/bin/jq
58
63
  - git config user.name "yad-gate-sync" && git config user.email "yad-gate-sync@noreply.${CI_SERVER_HOST}"
59
64
  - git remote set-url origin "https://oauth2:${SDLC_GATE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
60
65
  - export GITLAB_TOKEN="$SDLC_GATE_TOKEN" GITLAB_HOST="$CI_SERVER_URL"
@@ -73,8 +78,8 @@ yad-gate-sync:
73
78
  # runs in a subshell, losing rc). An MR stuck beyond the window needs manual recovery — run
74
79
  # `yad gate ci --branch <review-branch> --pr <iid> --merged` locally on the default branch.
75
80
  SINCE="$(date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-7d +%Y-%m-%dT%H:%M:%SZ)"
76
- glab api --paginate "projects/:id/merge_requests?state=merged&updated_after=${SINCE}&per_page=100&order_by=updated_at" \
77
- --jq '.[] | select(.source_branch | startswith("review/EP-")) | "\(.iid) \(.source_branch)"' > /tmp/yad-merged-mrs || rc=1
81
+ glab api --paginate "projects/:id/merge_requests?state=merged&updated_after=${SINCE}&per_page=100&order_by=updated_at" > /tmp/yad-raw-mrs 2>/dev/null || rc=1
82
+ jq -r '.[] | select(.source_branch | startswith("review/EP-")) | "\(.iid) \(.source_branch)"' /tmp/yad-raw-mrs > /tmp/yad-merged-mrs || rc=1
78
83
  while read -r IID REF; do
79
84
  [ -n "$IID" ] || continue
80
85
  git checkout -q -B "$CI_DEFAULT_BRANCH" "origin/$CI_DEFAULT_BRANCH"
@@ -85,7 +90,9 @@ yad-gate-sync:
85
90
  # IID from its source branch so `gate ci` can re-read approvals, then advance there.
86
91
  REVIEW_BRANCH="$(printf '%s' "$CI_COMMIT_MESSAGE" | grep -oE 'review/EP-[A-Za-z0-9._/-]+' | head -n1 || true)"
87
92
  if [ -n "$REVIEW_BRANCH" ]; then
88
- IID="$(glab api "projects/:id/merge_requests?source_branch=${REVIEW_BRANCH}&state=merged" --jq '.[0].iid' 2>/dev/null || true)"
93
+ # `.[0].iid // empty` so an empty MR array yields an empty IID (jq prints "null" otherwise),
94
+ # which keeps the "could not resolve" branch below correct.
95
+ IID="$(glab api "projects/:id/merge_requests?source_branch=${REVIEW_BRANCH}&state=merged" 2>/dev/null | jq -r '.[0].iid // empty' || true)"
89
96
  if [ -n "$IID" ]; then
90
97
  # Pass --pr + IID as two distinct args (avoid a fragile, shell-dependent ${IID:+...} split).
91
98
  npx -y -p yadflow@3 yad gate ci --branch "$REVIEW_BRANCH" --pr "$IID" --merged || rc=1
@@ -63,7 +63,9 @@ Never create a merge commit, rebase, or force.
63
63
  Per repo: `switched to <branch>, pulled (ff)` / `already current` / `SKIPPED (...)`. Pulling moves HEAD,
64
64
  so any repo whose `HEAD` now differs from its registry `syncedHead` has a **stale code-context pack** —
65
65
  the command ends by pointing the human at `yad repo refresh` to repack (that is a separate human
66
- decision; this skill never repacks or writes the registry).
66
+ decision; this skill never repacks or writes the registry). After the repack + AI code-map
67
+ regeneration, `yad repo refresh --push` publishes the refreshed code-maps + registry to the hub's
68
+ default branch as a `chore(hub): sync code-context … [skip ci]` audit commit.
67
69
 
68
70
  ## Hard rules
69
71