@plexus-ms/lib 0.127.0 → 0.128.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 (62) hide show
  1. package/dist/bookkeeping.d.ts +0 -4
  2. package/dist/bookkeeping.d.ts.map +1 -1
  3. package/dist/bookkeeping.js +0 -4
  4. package/dist/bookkeeping.js.map +1 -1
  5. package/dist/conflicts.d.ts +12 -0
  6. package/dist/conflicts.d.ts.map +1 -0
  7. package/dist/conflicts.js +48 -0
  8. package/dist/conflicts.js.map +1 -0
  9. package/dist/consumers.d.ts +20 -0
  10. package/dist/consumers.d.ts.map +1 -1
  11. package/dist/consumers.js +34 -2
  12. package/dist/consumers.js.map +1 -1
  13. package/dist/copier.d.ts +2 -0
  14. package/dist/copier.d.ts.map +1 -1
  15. package/dist/copier.js +10 -2
  16. package/dist/copier.js.map +1 -1
  17. package/dist/deployTargets.d.ts +22 -5
  18. package/dist/deployTargets.d.ts.map +1 -1
  19. package/dist/deployTargets.js +53 -13
  20. package/dist/deployTargets.js.map +1 -1
  21. package/dist/doctor.d.ts +4 -2
  22. package/dist/doctor.d.ts.map +1 -1
  23. package/dist/doctor.js +19 -1
  24. package/dist/doctor.js.map +1 -1
  25. package/dist/index.d.ts +10 -8
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +9 -7
  28. package/dist/index.js.map +1 -1
  29. package/dist/io.d.ts +6 -0
  30. package/dist/io.d.ts.map +1 -1
  31. package/dist/io.js +19 -0
  32. package/dist/io.js.map +1 -1
  33. package/dist/overview.d.ts +13 -0
  34. package/dist/overview.d.ts.map +1 -1
  35. package/dist/overview.js +35 -2
  36. package/dist/overview.js.map +1 -1
  37. package/dist/pull.d.ts +153 -0
  38. package/dist/pull.d.ts.map +1 -0
  39. package/dist/pull.js +429 -0
  40. package/dist/pull.js.map +1 -0
  41. package/dist/recursive.d.ts +8 -0
  42. package/dist/recursive.d.ts.map +1 -0
  43. package/dist/recursive.js +60 -0
  44. package/dist/recursive.js.map +1 -0
  45. package/dist/standard-index.json +1 -1
  46. package/dist/summary.d.ts +35 -1
  47. package/dist/summary.d.ts.map +1 -1
  48. package/dist/summary.js +95 -8
  49. package/dist/summary.js.map +1 -1
  50. package/dist/take.d.ts +54 -43
  51. package/dist/take.d.ts.map +1 -1
  52. package/dist/take.js +152 -181
  53. package/dist/take.js.map +1 -1
  54. package/dist/update.d.ts +59 -2
  55. package/dist/update.d.ts.map +1 -1
  56. package/dist/update.js +146 -58
  57. package/dist/update.js.map +1 -1
  58. package/package.json +1 -1
  59. package/dist/propagate.d.ts +0 -16
  60. package/dist/propagate.d.ts.map +0 -1
  61. package/dist/propagate.js +0 -51
  62. package/dist/propagate.js.map +0 -1
package/dist/take.js CHANGED
@@ -4,54 +4,38 @@
4
4
  // the lockfile refreshed where manifests moved, the hand-owned workflows pinned to the version; then one
5
5
  // commit, pushed as `plexus/<version>`, and a pull request against the branch.
6
6
  // A conflict is committed with its markers and reported, and the pull request
7
- // is opened all the same: that is where it gets resolved. Nothing here aborts
8
- // a run: a failing or conflicting site is recorded in the summary, which says
9
- // what needs a human. Reviewing and merging the pull request stays human.
7
+ // is opened all the same, as a draft where the forge offers one, whose body
8
+ // opens with what needs a hand (pull.ts): that is where it gets resolved. Nothing here aborts
9
+ // a run: what became of each site, the lockfile and the pull request is
10
+ // returned as data (`Taken`), which the caller folds into the summary that
11
+ // says what needs a human (summary.ts). Reviewing and merging the pull
12
+ // request stays human.
10
13
  //
11
14
  // `update` (update.ts) is the verb on top of it, and the only thing that
12
- // opens a version's pull request; `propagate` (propagate.ts) runs that verb over
13
- // many repos. The maintainers' preview of an unreleased version (preview.ts of
14
- // @plexus-ms/dev) uses the same steps against the local template checkouts, and opens nothing.
15
+ // opens a version's pull request; `update --recursive` (recursive.ts) runs
16
+ // that verb over many repos. The maintainers' preview of an unreleased
17
+ // version (preview.ts of @plexus-ms/dev) uses the same steps with its own
18
+ // `SiteUpdate`, against the local template checkouts, and opens nothing.
15
19
  import { join, relative } from 'node:path';
16
- import { bumpWorkflowRefs, hasConflictMarkers, hasUnmergedEntries, WORKFLOW_REF } from "./bookkeeping.js";
17
- import { ANSWERS_FILE, copierVia } from "./copier.js";
20
+ import { bumpWorkflowRefs, WORKFLOW_REF } from "./bookkeeping.js";
21
+ import { filesWithConflictMarkers, hasConflictMarkers, hasUnmergedEntries } from "./conflicts.js";
22
+ import { ANSWERS_FILE, copierVia, parseAnswers, setAnswer } from "./copier.js";
18
23
  import { run, write } from "./effects.js";
24
+ import { detailOf } from "./io.js";
25
+ import { askForReviews, createPull, needsAHand, pullBody, pullOf, versionBranch, } from "./pull.js";
19
26
  import { namesOldTemplate, templateSource } from "./templates.js";
20
- /** True when nothing in the summary needs a human but the pull requests. */
21
- export const isClean = (s) => s.conflicted.length === 0 && s.failed.length === 0 && s.skipped.length === 0;
22
- /** Add what one repo's run found to the summary of a run over many. */
23
- export function mergeSummary(into, from) {
24
- into.clean.push(...from.clean);
25
- into.conflicted.push(...from.conflicted);
26
- into.failed.push(...from.failed);
27
- into.skipped.push(...from.skipped);
28
- into.resting.push(...from.resting);
29
- into.pulls.push(...from.pulls);
30
- into.mergeable.push(...from.mergeable);
31
- }
32
- export const emptySummary = (version, preview) => ({
33
- version,
34
- preview,
35
- clean: [],
36
- conflicted: [],
37
- failed: [],
38
- skipped: [],
39
- resting: [],
40
- pulls: [],
41
- mergeable: [],
42
- });
43
- /** What a pull request's body says when nothing in it needs a hand; read back to tell a clean one found on origin. */
44
- export const CLEAN_BODY = 'Merged clean at every site.';
45
- /** The entries of a summary list that belong to a consumer: itself, its sites, its lockfile. */
46
- const ofConsumer = (list, consumer) => list.filter((p) => p === consumer.rel || p.startsWith(`${consumer.rel}/`));
47
- export const versionBranch = (version) => `plexus/${version}`;
27
+ /** Whether the consumer needs a hand beyond reviewing its pull request. */
28
+ export const needsHand = (t) => t.sites.some((s) => s.outcome !== 'clean') ||
29
+ (t.marked?.length ?? 0) > 0 ||
30
+ t.lockfile === 'failed' ||
31
+ t.failed !== undefined;
48
32
  /**
49
33
  * copier at the version plx pins, through mise, with the consumer's own mise
50
34
  * config ignored: copier needs no project tool, and a root `mise.toml` left
51
35
  * with conflict markers by the root site's update would otherwise fail every
52
36
  * later mise call in the directory, the apps' updates first of all.
53
37
  */
54
- const copierIn = (dir, args) => [
38
+ export const copierIn = (dir, args) => [
55
39
  'env',
56
40
  [`MISE_IGNORED_CONFIG_PATHS=${dir}`, 'mise', ...copierVia(args)],
57
41
  ];
@@ -60,16 +44,19 @@ const copierIn = (dir, args) => [
60
44
  * every site updated, the lockfile refreshed, the workflow refs bumped, then
61
45
  * the commit, the branch and the pull request.
62
46
  */
63
- export async function takeVersion(ctx, consumer, dir, take, summary) {
47
+ export async function takeVersion(ctx, consumer, dir, take) {
64
48
  const base = (await ctx.read('git', ['rev-parse', 'HEAD'], { cwd: dir })).trim();
49
+ const update = take.update ?? fromTemplate(take.ref);
50
+ const sites = [];
65
51
  for (const site of consumer.sites)
66
- await updateSite(ctx, consumer, site, dir, take, summary);
67
- await refreshLockfile(ctx, consumer, dir, base, summary);
52
+ sites.push(await updateSite(ctx, consumer, site, dir, update));
53
+ const lockfile = await refreshLockfile(ctx, consumer, dir, base);
68
54
  await bumpConsumerRefs(ctx, consumer, dir, take.version);
69
- await openPull(ctx, consumer, dir, take, summary);
55
+ const taken = { rel: consumer.rel, sites, ...(lockfile ? { lockfile } : {}) };
56
+ return { ...taken, ...(await openPull(ctx, consumer, dir, base, take, taken)) };
70
57
  }
71
- // Preview commits are plain plumbing on a throwaway clone: unsigned, no hooks, a stand-in identity.
72
- const previewCommit = (ctx, dir, message) => ctx
58
+ /** A commit of plain plumbing on a scratch checkout: unsigned, no hooks, a stand-in identity. */
59
+ export const scratchCommit = (ctx, dir, message) => ctx
73
60
  .stage(run('git', ['add', '-A'], { cwd: dir }))
74
61
  .then(() => ctx.stage(run('git', [
75
62
  '-c',
@@ -85,56 +72,48 @@ const previewCommit = (ctx, dir, message) => ctx
85
72
  '-m',
86
73
  message,
87
74
  ], { cwd: dir })));
88
- async function updateSite(ctx, consumer, site, dir, take, summary) {
75
+ /** copier against the published template, at `ref`. */
76
+ const fromTemplate = (ref) => async (ctx, site, target, dir) => {
77
+ ctx.say(`→ ${site.rel}: copier update${ref ? ` to ${ref}` : ''}`);
78
+ // A template renamed on a version: the answers still name the old source,
79
+ // which copier would clone through the forge's redirect; point them at
80
+ // the current name first, committed because copier refuses a dirty
81
+ // subproject.
82
+ const answers = await ctx.readFile(join(target, ANSWERS_FILE));
83
+ const current = templateSource(site.template);
84
+ const recorded = parseAnswers(answers).src;
85
+ if (recorded && namesOldTemplate(recorded)) {
86
+ ctx.say(` ${site.rel}: the template is ${current} now; the answers follow`);
87
+ await ctx.stage(write(join(target, ANSWERS_FILE), setAnswer(answers, '_src_path', current)));
88
+ await scratchCommit(ctx, dir, `plx: ${site.rel} reads ${current}, the template's name since its rename`);
89
+ }
90
+ // Template tasks (mise install, hook setup) serve a developer's checkout,
91
+ // not a pull request. Unattended, a new question takes its default; on a
92
+ // terminal copier asks. A dry run previews on the scratch checkout, so
93
+ // the step is staged there rather than only announced.
94
+ const args = [
95
+ 'update',
96
+ '--skip-answered',
97
+ '--trust',
98
+ '--skip-tasks',
99
+ ...(ref ? ['--vcs-ref', ref] : []),
100
+ ...(ctx.yes || ctx.dryRun ? ['--defaults'] : []),
101
+ ];
102
+ const step = run(...copierIn(dir, args), { cwd: target, interactive: !ctx.dryRun });
103
+ if (ctx.dryRun)
104
+ await ctx.stage(step);
105
+ else
106
+ await ctx.apply([step]);
107
+ };
108
+ async function updateSite(ctx, consumer, site, dir, update) {
89
109
  const target = join(dir, relative(consumer.path, site.path));
90
110
  try {
91
- if (take.previewFrom) {
92
- const localTemplate = join(take.previewFrom, site.template);
93
- ctx.say(`→ ${site.rel}: copier update (preview from ${localTemplate}@main)`);
94
- // Point the answers at the local template so the preview reads it; copier
95
- // refuses a dirty subproject, hence the commit.
96
- const answers = await ctx.readFile(join(target, ANSWERS_FILE));
97
- await ctx.stage(write(join(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${localTemplate}`)));
98
- await previewCommit(ctx, dir, `plx preview: ${site.rel} reads ${localTemplate} from the local checkout`);
99
- await ctx.stage(run(...copierIn(dir, ['update', '--skip-answered', '--trust', '--defaults', '--skip-tasks', '--vcs-ref', 'main']), { cwd: target }));
100
- }
101
- else {
102
- ctx.say(`→ ${site.rel}: copier update${take.ref ? ` to ${take.ref}` : ''}`);
103
- // A template renamed on a version: the answers still name the old source,
104
- // which copier would clone through the forge's redirect; point them at
105
- // the current name first, committed because copier refuses a dirty
106
- // subproject.
107
- const answers = await ctx.readFile(join(target, ANSWERS_FILE));
108
- const current = templateSource(site.template);
109
- const recorded = /^_src_path: (.*)$/m.exec(answers)?.[1];
110
- if (recorded && namesOldTemplate(recorded)) {
111
- ctx.say(` ${site.rel}: the template is ${current} now; the answers follow`);
112
- await ctx.stage(write(join(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${current}`)));
113
- await previewCommit(ctx, dir, `plx: ${site.rel} reads ${current}, the template's name since its rename`);
114
- }
115
- // Template tasks (mise install, hook setup) serve a developer's checkout,
116
- // not a pull request. Unattended, a new question takes its default; on a
117
- // terminal copier asks. A dry run previews on the scratch checkout, so
118
- // the step is staged there rather than only announced.
119
- const args = [
120
- 'update',
121
- '--skip-answered',
122
- '--trust',
123
- '--skip-tasks',
124
- ...(take.ref ? ['--vcs-ref', take.ref] : []),
125
- ...(ctx.yes || ctx.dryRun ? ['--defaults'] : []),
126
- ];
127
- const step = run(...copierIn(dir, args), { cwd: target, interactive: !ctx.dryRun });
128
- if (ctx.dryRun)
129
- await ctx.stage(step);
130
- else
131
- await ctx.apply([step]);
132
- }
111
+ await update(ctx, site, target, dir);
133
112
  }
134
113
  catch (error) {
135
- ctx.say(` ✗ FAILED — copier update exited nonzero${detail(error)}`);
136
- summary.failed.push(site.rel);
137
- return;
114
+ const why = detailOf(error);
115
+ ctx.say(` ✗ FAILED — copier update exited nonzero${why ? `: ${why}` : ''}`);
116
+ return { rel: site.rel, outcome: 'failed', ...(why ? { detail: why } : {}) };
138
117
  }
139
118
  // copier applies the template diff with `git apply --3way`, which leaves
140
119
  // unmerged index entries and inline markers when a hunk does not apply.
@@ -150,50 +129,45 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
150
129
  if (hasConflictMarkers(text))
151
130
  conflict = true;
152
131
  }
153
- if (conflict) {
132
+ if (conflict)
154
133
  ctx.say(' ✗ CONFLICTS — committed with their <<<<<<< markers, to resolve in the pull request:');
155
- summary.conflicted.push(site.rel);
156
- }
157
- else {
134
+ else
158
135
  ctx.say(' ✓ merged clean:');
159
- summary.clean.push(site.rel);
160
- }
161
136
  for (const line of status.split('\n').filter(Boolean))
162
137
  ctx.say(` ${line}`);
163
- // Each preview-from-local site is committed so the next site's answers
164
- // rewrite starts from a clean tree. Otherwise the site is staged: a conflict
165
- // leaves unmerged index entries, and copier's own git plumbing (`git
166
- // write-tree`) refuses an index with those, so the next site's update would
167
- // fail; staged, the markers are in the tree and the index is whole.
168
- if (take.previewFrom)
169
- await previewCommit(ctx, dir, `plx preview: ${site.rel} updated`);
170
- else
171
- await ctx.stage(run('git', ['add', '-A'], { cwd: dir }));
138
+ // Staged, so that the next site starts from a whole index: a conflict
139
+ // leaves unmerged entries, and copier's own git plumbing (`git
140
+ // write-tree`) refuses an index with those, so the next site's update
141
+ // would fail; staged, the markers are in the tree and the index is whole.
142
+ await ctx.stage(run('git', ['add', '-A'], { cwd: dir }));
143
+ return { rel: site.rel, outcome: conflict ? 'conflicted' : 'clean' };
172
144
  }
173
145
  /**
174
146
  * Refresh the lockfile when the updates touched a manifest (`mise exec` trusts the directory's own config).
175
147
  * The lockfile is what this step writes, so the install is never frozen: pnpm freezes it by default under CI,
176
148
  * where the update workflow runs.
177
149
  */
178
- async function refreshLockfile(ctx, consumer, dir, base, summary) {
150
+ async function refreshLockfile(ctx, consumer, dir, base) {
179
151
  if ((await ctx.readFile(join(dir, 'pnpm-workspace.yaml')).catch(() => undefined)) === undefined)
180
- return;
152
+ return undefined;
181
153
  const manifests = ['*package.json', 'pnpm-workspace.yaml'];
182
154
  const unchanged = await ctx
183
155
  .read('git', ['diff', '--quiet', base, '--', ...manifests], { cwd: dir })
184
156
  .then(() => true)
185
157
  .catch(() => false);
186
158
  if (unchanged)
187
- return;
159
+ return undefined;
188
160
  ctx.say(`→ ${consumer.rel}: pnpm install (manifests changed)`);
189
161
  try {
190
162
  await ctx.apply([
191
163
  run('mise', ['exec', '--', 'pnpm', 'install', '--no-frozen-lockfile', '--reporter=silent'], { cwd: dir }),
192
164
  ]);
165
+ return 'refreshed';
193
166
  }
194
167
  catch (error) {
195
- ctx.say(` ✗ pnpm install failed${detail(error)}`);
196
- summary.failed.push(`${consumer.rel}/pnpm-lock.yaml`);
168
+ const why = detailOf(error);
169
+ ctx.say(` ✗ pnpm install failed${why ? `: ${why}` : ''}`);
170
+ return 'failed';
197
171
  }
198
172
  }
199
173
  /** Consumers' hand-owned workflows pin the reusable workflows by tag; lockstep them to the version. */
@@ -215,101 +189,98 @@ async function bumpConsumerRefs(ctx, consumer, dir, version) {
215
189
  await ctx.stage(write(join(workflows, f), bumped));
216
190
  }
217
191
  }
218
- /** The URL of the open pull request from the version branch against the consumer's branch, if any. */
219
- export async function openPullUrl(ctx, consumer, dir, version) {
220
- const args = ['pr', 'list', '--head', versionBranch(version), '--base', consumer.branch, '--state', 'open'];
221
- return (await ctx.read('gh', [...args, '--json', 'url', '--jq', '.[0].url'], { cwd: dir }).catch(() => '')).trim();
222
- }
223
192
  /**
224
193
  * One commit, the version branch pushed, and a pull request against the
225
- * consumer's branch: opened once, found again on a re-run. The branch is plx's
226
- * own, so a re-run may move it, with a lease on what it fetched. Hooks are
227
- * skipped: the checks are the pull request's job, and the mount's own
228
- * checkout may carry the repo's hooks.
194
+ * consumer's branch, opened once. The push only creates the branch: one
195
+ * already on origin is never moved (pull.ts). Hooks are skipped: the checks
196
+ * are the pull request's job, and the mount's own checkout may carry the
197
+ * repo's hooks. The pull request is a draft when anything needs a hand, and
198
+ * its body says what, from what the sites and the lockfile came to and the
199
+ * detector over the committed tree.
229
200
  */
230
- async function openPull(ctx, consumer, dir, take, summary) {
201
+ async function openPull(ctx, consumer, dir, base, take, taken) {
231
202
  const { version } = take;
232
203
  const branch = versionBranch(version);
233
204
  if (ctx.dryRun) {
234
205
  ctx.say(` (preview) ${consumer.rel}: would commit, push ${branch} and open a pull request against ${consumer.branch}`);
235
- return;
206
+ return {};
236
207
  }
237
- if ((await ctx.read('git', ['status', '--porcelain'], { cwd: dir })).trim() === '') {
208
+ const moved = (await ctx.read('git', ['rev-parse', 'HEAD'], { cwd: dir })).trim() !== base;
209
+ if (!moved && (await ctx.read('git', ['status', '--porcelain'], { cwd: dir })).trim() === '') {
238
210
  ctx.say(`• ${consumer.rel}: nothing changed — no pull request`);
239
- return;
211
+ return {};
240
212
  }
241
213
  const head = `${consumer.origin ?? 'origin'} ${branch}`;
242
214
  try {
243
215
  await ctx.apply([
216
+ // Staged first: a site whose copier run failed mid-merge can leave unmerged entries, which a reset refuses.
244
217
  run('git', ['add', '-A'], { cwd: dir }),
218
+ // One commit on the branch, the scratch ones folded in: a later run tells it from a human's by the count.
219
+ run('git', ['reset', '--quiet', '--soft', base], { cwd: dir }),
245
220
  run('git', ['commit', '--quiet', '--no-verify', '-m', `chore: Plexus ${version}`], { cwd: dir }),
246
- ]);
247
- // The lease needs the remote-tracking ref; a fresh clone has none for a branch it did not check out.
248
- await ctx
249
- .read('git', ['fetch', '--quiet', 'origin', `+refs/heads/${branch}:refs/remotes/origin/${branch}`], {
250
- cwd: dir,
251
- })
252
- .catch(() => '');
253
- await ctx.apply([
254
- run('git', ['push', '--quiet', '--no-verify', '--force-with-lease', 'origin', `HEAD:refs/heads/${branch}`], {
255
- cwd: dir,
256
- }),
221
+ // An empty expected value: the branch must not exist on origin yet.
222
+ run('git', [
223
+ 'push',
224
+ '--quiet',
225
+ '--no-verify',
226
+ `--force-with-lease=refs/heads/${branch}:`,
227
+ 'origin',
228
+ `HEAD:refs/heads/${branch}`,
229
+ ], { cwd: dir }),
257
230
  ]);
258
231
  }
259
232
  catch (error) {
260
- ctx.say(` ✗ FAILED — push to ${head}${detail(error)}`);
261
- summary.failed.push(consumer.rel);
262
- return;
233
+ const why = detailOf(error);
234
+ ctx.say(` ✗ FAILED — push to ${head}${why ? `: ${why}` : ''}`);
235
+ return { failed: `push to ${head}${why ? `: ${why}` : ''}` };
263
236
  }
264
- const conflicted = ofConsumer(summary.conflicted, consumer);
265
- const failed = ofConsumer(summary.failed, consumer);
266
- const clean = conflicted.length === 0 && failed.length === 0;
267
- const existing = await openPullUrl(ctx, consumer, dir, version);
268
- if (existing) {
269
- ctx.say(`• ${consumer.rel}: pull request updated: ${existing}`);
270
- summary.pulls.push(existing);
271
- if (clean)
272
- summary.mergeable.push(existing);
273
- return;
237
+ const marked = await filesWithConflictMarkers(ctx, dir);
238
+ const of = (outcome) => taken.sites.filter((s) => s.outcome === outcome).map((s) => siteOf(consumer, s.rel));
239
+ const state = {
240
+ version,
241
+ sites: consumer.sites.map((s) => relative(consumer.path, s.path) || '.'),
242
+ conflicted: of('conflicted'),
243
+ marked,
244
+ failed: of('failed'),
245
+ lockfile: taken.lockfile === 'failed',
246
+ note: `Opened by ${take.opener}${take.why ? `: ${take.why}` : ''}.`,
247
+ };
248
+ if (marked.length > 0)
249
+ ctx.say(` ${consumer.rel}: conflict markers in ${marked.join(', ')}`);
250
+ let draft;
251
+ try {
252
+ draft = await createPull(ctx, consumer.rel, { base: consumer.branch, version, body: pullBody(state), draft: needsAHand(state) }, dir);
253
+ }
254
+ catch (error) {
255
+ const why = detailOf(error);
256
+ ctx.say(` ✗ FAILED — pull request${why ? `: ${why}` : ''}`);
257
+ return { marked, failed: `pull request${why ? `: ${why}` : ''}` };
274
258
  }
275
- const sites = consumer.sites.map((s) => s.rel);
276
- const body = [
277
- `Plexus ${version} (§ 1.5 PLX): \`copier update\` at ${sites.join(', ')}, the lockfile where manifests moved, and the workflow refs.`,
278
- ...(conflicted.length > 0 ? [`Conflicts to resolve, committed with their markers: ${conflicted.join(', ')}.`] : []),
279
- ...(failed.length > 0 ? [`Failed, and left as it was: ${failed.join(', ')}.`] : []),
280
- ...(clean ? [CLEAN_BODY] : []),
281
- `Opened by ${take.opener}${take.why ? `: ${take.why}` : ''}.`,
282
- ].join('\n\n');
259
+ // Asking the forge for what it opened is a read like any other: a failure is reported, never "none".
260
+ let opened;
283
261
  try {
284
- await ctx.apply([
285
- run('gh', [
286
- 'pr',
287
- 'create',
288
- '--base',
289
- consumer.branch,
290
- '--head',
291
- branch,
292
- '--title',
293
- `chore: Plexus ${version}`,
294
- '--body',
295
- body,
296
- ], { cwd: dir }),
297
- ]);
262
+ opened = await pullOf(ctx, consumer, dir, version);
298
263
  }
299
264
  catch (error) {
300
- ctx.say(` ✗ FAILED — pull request${detail(error)}`);
301
- summary.failed.push(consumer.rel);
302
- return;
265
+ const why = detailOf(error);
266
+ ctx.say(` ✗ FAILED — ${consumer.rel}: the pull request opened, but listing it failed${why ? `: ${why}` : ''}`);
267
+ return { marked, pull: { branch, draft }, failed: `listing the pull request: ${why}` };
303
268
  }
304
- const url = await openPullUrl(ctx, consumer, dir, version);
305
- ctx.say(`• ${consumer.rel}: pull request opened${url ? `: ${url}` : ''}`);
306
- summary.pulls.push(url || `${consumer.rel} ${branch}`);
307
- if (url && clean)
308
- summary.mergeable.push(url);
269
+ const url = opened?.url;
270
+ ctx.say(`• ${consumer.rel}: ${draft ? 'draft ' : ''}pull request opened${url ? `: ${url}` : ''}`);
271
+ const pull = { branch, draft, ...(url ? { url } : {}) };
272
+ if (!opened)
273
+ return { marked, pull, failed: 'the forge did not list the pull request it opened' };
274
+ // Unless named, from the root answers as copier left them at every site: a renamed or changed answer counts.
275
+ const from = take.reviewers ?? {
276
+ answersFile: await ctx.readFile(join(dir, ANSWERS_FILE)).catch(() => ''),
277
+ };
278
+ const review = await askForReviews(ctx, consumer.rel, opened, from, dir);
279
+ return { marked, pull, ...(review ? { review } : {}) };
280
+ }
281
+ /** A site's name in the run, as the repo names it: `.` for its root. */
282
+ function siteOf(consumer, rel) {
283
+ const s = consumer.sites.find((x) => x.rel === rel);
284
+ return s ? relative(consumer.path, s.path) || '.' : rel;
309
285
  }
310
- export const detail = (error) => {
311
- const message = error instanceof Error ? error.message : String(error);
312
- const last = message.trim().split('\n').at(-1) ?? '';
313
- return last && !/exited with/.test(last) ? `: ${last}` : '';
314
- };
315
286
  //# sourceMappingURL=take.js.map
package/dist/take.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"take.js","sourceRoot":"","sources":["../src/take.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,0EAA0E;AAC1E,+EAA+E;AAC/E,yGAAyG;AACzG,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,EAAE;AACF,yEAAyE;AACzE,iFAAiF;AACjF,+EAA+E;AAC/E,+FAA+F;AAC/F,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAqBlE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAU,EAAW,EAAE,CAC7C,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,OAA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,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC1D,CAAC"}
package/dist/update.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { type Consumer } from './consumers.ts';
1
2
  import type { Context } from './context.ts';
2
- import { type Summary } from './take.ts';
3
+ import { type Release } from './need.ts';
4
+ import { type Review } from './pull.ts';
5
+ import { type Taken } from './take.ts';
3
6
  export interface UpdateOptions {
4
7
  /** The repo to update: a checkout whose root is a site of a repo template. */
5
8
  repo: string;
@@ -13,6 +16,60 @@ export interface UpdateOptions {
13
16
  maxAge?: number;
14
17
  /** The clock the interval is measured against, as a date; default: now. */
15
18
  today?: string;
19
+ /** The users asked to review the pull request it opens; default: the repo's answer `pr_reviewers`, else none. */
20
+ reviewers?: string[];
16
21
  }
17
- export declare function update(ctx: Context, options: UpdateOptions): Promise<Summary>;
22
+ /**
23
+ * What a run over many repos (recursive.ts) has read once for all of them,
24
+ * so that `update` reads none of it again: the repo as the walk found it,
25
+ * named as that run names it, and the versions, listed after the login was
26
+ * checked (none when a version is named).
27
+ */
28
+ export interface Known {
29
+ consumer: Consumer;
30
+ releases: Release[];
31
+ }
32
+ /**
33
+ * What one repo's run came to; `version` is the one it took, looked at, or
34
+ * would take. `current`: every site records it already. `skipped`: left
35
+ * untouched, with why. `resting`: needs no version yet (need.ts), with what
36
+ * would end the rest. `found`: its version branch is on origin already, with
37
+ * the pull request found or, when there was none, opened there, the files of
38
+ * the branch that hold conflict markers, its sites whose answers do not
39
+ * record the version, whether it is ready to merge, why
40
+ * looking at it failed, if it did, and the review request of one opened.
41
+ * A closed or merged one is no pull to list.
42
+ * `taken`: it took the version. `failed`: it could not be worked on, with why.
43
+ */
44
+ export type Outcome = {
45
+ repo: string;
46
+ version: string;
47
+ } & ({
48
+ kind: 'current';
49
+ } | {
50
+ kind: 'skipped';
51
+ reason: string;
52
+ } | {
53
+ kind: 'resting';
54
+ reason: string;
55
+ } | {
56
+ kind: 'found';
57
+ pull?: string;
58
+ /** A dry run would open the missing pull request. */
59
+ opening?: true;
60
+ marked: string[];
61
+ behind: string[];
62
+ mergeable: boolean;
63
+ failed?: string;
64
+ review?: Review;
65
+ } | {
66
+ kind: 'taken';
67
+ taken: Taken;
68
+ } | {
69
+ kind: 'failed';
70
+ detail: string;
71
+ });
72
+ export declare function update(ctx: Context, options: UpdateOptions, known?: Known): Promise<Outcome>;
73
+ /** The versions (§ 1.6 PLX: every version tag has a release), with the dates they were cut; a draft is no version yet. */
74
+ export declare function releasesOf(ctx: Context): Promise<Release[]>;
18
75
  //# sourceMappingURL=update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAM5C,OAAO,EAAiD,KAAK,OAAO,EAA8B,MAAM,WAAW,CAAC;AAIpH,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2FAA2F;IAC3F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CA8GnF"}
1
+ {"version":3,"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