@plexus-ms/lib 0.126.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.
- package/dist/bookkeeping.d.ts +0 -4
- package/dist/bookkeeping.d.ts.map +1 -1
- package/dist/bookkeeping.js +0 -4
- package/dist/bookkeeping.js.map +1 -1
- package/dist/conflicts.d.ts +12 -0
- package/dist/conflicts.d.ts.map +1 -0
- package/dist/conflicts.js +48 -0
- package/dist/conflicts.js.map +1 -0
- package/dist/consumers.d.ts +20 -0
- package/dist/consumers.d.ts.map +1 -1
- package/dist/consumers.js +34 -2
- package/dist/consumers.js.map +1 -1
- package/dist/copier.d.ts +2 -0
- package/dist/copier.d.ts.map +1 -1
- package/dist/copier.js +10 -2
- package/dist/copier.js.map +1 -1
- package/dist/deployTargets.d.ts +22 -5
- package/dist/deployTargets.d.ts.map +1 -1
- package/dist/deployTargets.js +53 -13
- package/dist/deployTargets.js.map +1 -1
- package/dist/doctor.d.ts +4 -2
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +19 -1
- package/dist/doctor.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/io.d.ts +6 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +19 -0
- package/dist/io.js.map +1 -1
- package/dist/overview.d.ts +13 -0
- package/dist/overview.d.ts.map +1 -1
- package/dist/overview.js +35 -2
- package/dist/overview.js.map +1 -1
- package/dist/pull.d.ts +153 -0
- package/dist/pull.d.ts.map +1 -0
- package/dist/pull.js +429 -0
- package/dist/pull.js.map +1 -0
- package/dist/recursive.d.ts +8 -0
- package/dist/recursive.d.ts.map +1 -0
- package/dist/recursive.js +60 -0
- package/dist/recursive.js.map +1 -0
- package/dist/standard-index.json +1 -1
- package/dist/summary.d.ts +35 -1
- package/dist/summary.d.ts.map +1 -1
- package/dist/summary.js +95 -8
- package/dist/summary.js.map +1 -1
- package/dist/take.d.ts +54 -43
- package/dist/take.d.ts.map +1 -1
- package/dist/take.js +152 -181
- package/dist/take.js.map +1 -1
- package/dist/umbrella.d.ts.map +1 -1
- package/dist/umbrella.js +3 -0
- package/dist/umbrella.js.map +1 -1
- package/dist/update.d.ts +59 -2
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +146 -58
- package/dist/update.js.map +1 -1
- package/package.json +1 -1
- package/dist/propagate.d.ts +0 -16
- package/dist/propagate.d.ts.map +0 -1
- package/dist/propagate.js +0 -51
- package/dist/propagate.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../src/pull.ts"],"names":[],"mappings":"AAkDA,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MAA6B,CAAC;AAE9E,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAUpE;AAYD,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAItE;AAED,yGAAyG;AACzG,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,EAAE,KAAK,MAAM,gCAWzE,CAAC;AAEJ,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAK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B;AAKD,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,gFAAgF;IAChF,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,wDAAwD;IACxD,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gDAAgD;IAChD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,CAAC,CA4CrB"}
|
package/dist/pull.js
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
// pull: the version's pull request (§ 3 PLX-Updates), on `plexus/<version>`
|
|
2
|
+
// against the branch the version lands on. take.ts opens it; a later run
|
|
3
|
+
// that finds the branch on origin with the pull request open comes back to it
|
|
4
|
+
// here (`revisit`).
|
|
5
|
+
//
|
|
6
|
+
// A pull request that needs a hand is asked for as a draft, and its body
|
|
7
|
+
// opens with what needs it: the sites that conflicted, the tracked files that
|
|
8
|
+
// hold conflict markers (conflicts.ts), the sites whose copier run failed,
|
|
9
|
+
// and, when the lockfile did not refresh, that `pnpm install` is to be run
|
|
10
|
+
// after resolving. Where the forge refuses a draft, the same pull request is
|
|
11
|
+
// opened as an ordinary one, and the run says so; it needs a hand all the
|
|
12
|
+
// same. One that needs none is ready for review.
|
|
13
|
+
//
|
|
14
|
+
// The branch is never moved by any run, and plx never pushes to it again: it
|
|
15
|
+
// is the human's from the moment it is on origin. A later run, scheduled or
|
|
16
|
+
// manual, reads it as origin has it: its tip's hash from `git ls-remote`, and
|
|
17
|
+
// that commit fetched by hash with no ref, no FETCH_HEAD and no
|
|
18
|
+
// remote-tracking ref written, so no checkout and no ref of the repo is
|
|
19
|
+
// touched, under a dry run as in a real one. At the tip it checks two things:
|
|
20
|
+
// that no tracked file holds a conflict marker, and that every site the tip
|
|
21
|
+
// holds records the version in its answers (`_commit`); a site that does not
|
|
22
|
+
// is one copier did not run at. Both hold: the pull request is ready. It
|
|
23
|
+
// writes the body afresh for what it checked (it never reads the body), and
|
|
24
|
+
// marks the pull request ready, or a draft again while either fails; a forge
|
|
25
|
+
// that refuses the draft leaves it ordinary, which the run says and does not
|
|
26
|
+
// count as a failure of its own. Whether the refresh of the lockfile failed is
|
|
27
|
+
// not known then, so the body asks for `pnpm install` and the lockfile
|
|
28
|
+
// wherever the tip holds one and the pull request is not ready, or the branch
|
|
29
|
+
// holds commits beyond the one plx made (somebody resolved by hand); plx's
|
|
30
|
+
// commit is told from the others by the count of commits the forge says the
|
|
31
|
+
// branch is ahead of the one the version lands on. Whether the pull request is
|
|
32
|
+
// ready to merge is read from its draft state and the tip, never from its
|
|
33
|
+
// body.
|
|
34
|
+
//
|
|
35
|
+
// A later run that finds the branch with no pull request in any state
|
|
36
|
+
// (opening failed after the push) opens the pull request then (`openLate`),
|
|
37
|
+
// ready or a draft by the same check, with the review request; a closed or
|
|
38
|
+
// merged one is left as it is, a human's decision. A closed one counts only
|
|
39
|
+
// when it was closed at the tip origin has now: one of an earlier branch of
|
|
40
|
+
// the name, deleted and pushed again, is not this branch's, and neither is
|
|
41
|
+
// one from a fork's branch of the name.
|
|
42
|
+
//
|
|
43
|
+
// The review is requested once, when plx opens the pull request, draft or
|
|
44
|
+
// not, from the users the root answers name as the pull request's branch has
|
|
45
|
+
// them, after copier ran at every site (`pr_reviewers`, a
|
|
46
|
+
// comma-separated string of GitHub user logins, empty or absent for none), or
|
|
47
|
+
// those `--reviewer` names instead; nothing more when it is marked ready.
|
|
48
|
+
// Users only: a team is refused. The request is one call for all of them, so
|
|
49
|
+
// the pull request's author is left out of it, and the run says so.
|
|
50
|
+
import { filesWithConflictMarkers } from "./conflicts.js";
|
|
51
|
+
import { sitesOfTree } from "./consumers.js";
|
|
52
|
+
import { ANSWERS_FILE, copierVia, parseAnswers } from "./copier.js";
|
|
53
|
+
import { run } from "./effects.js";
|
|
54
|
+
import { detailOf } from "./io.js";
|
|
55
|
+
export const versionBranch = (version) => `plexus/${version}`;
|
|
56
|
+
/** The answer of the repo templates that names who reviews the version's pull requests. */
|
|
57
|
+
export const REVIEWERS_ANSWER = 'pr_reviewers';
|
|
58
|
+
/**
|
|
59
|
+
* The user logins a comma-separated value names, in order, once each; blank
|
|
60
|
+
* for none. plx takes letters, digits and hyphens; a team (`org/team`) and
|
|
61
|
+
* anything else is refused, naming where it came from.
|
|
62
|
+
*/
|
|
63
|
+
export function parseReviewers(value, what) {
|
|
64
|
+
const logins = value
|
|
65
|
+
.split(',')
|
|
66
|
+
.map((l) => l.trim())
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
for (const login of logins) {
|
|
69
|
+
if (login.includes('/'))
|
|
70
|
+
throw new Error(`${what} names \`${login}\`, a team; only users are requested`);
|
|
71
|
+
if (!/^[A-Za-z0-9-]+$/.test(login))
|
|
72
|
+
throw new Error(`${what} names \`${login}\`, not a GitHub user login`);
|
|
73
|
+
}
|
|
74
|
+
return [...new Set(logins)];
|
|
75
|
+
}
|
|
76
|
+
/** A root answers file's answers; a file that is not YAML, or empty, is refused with what it is. */
|
|
77
|
+
function answersOf(text) {
|
|
78
|
+
if (text.trim() === '')
|
|
79
|
+
throw new Error(`the root ${ANSWERS_FILE} is empty or missing`);
|
|
80
|
+
try {
|
|
81
|
+
return parseAnswers(text).answers;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw new Error(`the root ${ANSWERS_FILE} cannot be read: ${error.message.split('\n')[0]}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** The reviewers a repo's root answers name; none when they name none. */
|
|
88
|
+
export function reviewersOf(answers) {
|
|
89
|
+
const value = answers[REVIEWERS_ANSWER];
|
|
90
|
+
if (value === undefined || value === null)
|
|
91
|
+
return [];
|
|
92
|
+
return parseReviewers(String(value), `the answer ${REVIEWERS_ANSWER}`);
|
|
93
|
+
}
|
|
94
|
+
/** The request for reviews from users on a pull request, by its number, in the repo `cwd` belongs to. */
|
|
95
|
+
export const requestReviews = (number, logins, cwd) => run('gh', [
|
|
96
|
+
'api',
|
|
97
|
+
`repos/{owner}/{repo}/pulls/${number}/requested_reviewers`,
|
|
98
|
+
'--method',
|
|
99
|
+
'POST',
|
|
100
|
+
...logins.flatMap((l) => ['-f', `reviewers[]=${l}`]),
|
|
101
|
+
], { cwd });
|
|
102
|
+
/**
|
|
103
|
+
* Open the version's pull request, as a draft when one is asked for. A forge
|
|
104
|
+
* that refuses the draft, for whatever reason, is asked once more for the
|
|
105
|
+
* same pull request as an ordinary one, and the run says so; when that fails
|
|
106
|
+
* too, the error names both attempts. Resolves with whether it is a draft.
|
|
107
|
+
*/
|
|
108
|
+
export async function createPull(ctx, name, req, cwd) {
|
|
109
|
+
const create = (draft) => run('gh', [
|
|
110
|
+
'pr',
|
|
111
|
+
'create',
|
|
112
|
+
...(draft ? ['--draft'] : []),
|
|
113
|
+
'--base',
|
|
114
|
+
req.base,
|
|
115
|
+
'--head',
|
|
116
|
+
versionBranch(req.version),
|
|
117
|
+
'--title',
|
|
118
|
+
`chore: Plexus ${req.version}`,
|
|
119
|
+
'--body',
|
|
120
|
+
req.body,
|
|
121
|
+
], { cwd });
|
|
122
|
+
if (!req.draft) {
|
|
123
|
+
await ctx.apply([create(false)]);
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
await ctx.apply([create(true)]);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
catch (refused) {
|
|
131
|
+
try {
|
|
132
|
+
await ctx.apply([create(false)]);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
throw new Error(`as a draft: ${detailOf(refused) || 'refused'}; as an ordinary one: ${detailOf(error) || 'refused'}`);
|
|
136
|
+
}
|
|
137
|
+
ctx.say(`• ${name}: the pull request is no draft: the forge refused one${detailOf(refused) ? ` (${detailOf(refused)})` : ''}`);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** How many pull requests of the version branch plx asks the forge for; none relies on gh's default. */
|
|
142
|
+
const LISTED = 1000;
|
|
143
|
+
/**
|
|
144
|
+
* The pull request from the version branch against the consumer's branch:
|
|
145
|
+
* the open one if there is one, else a closed or merged one whose head commit
|
|
146
|
+
* is `tip`, the branch's tip on origin, the highest numbered if several are.
|
|
147
|
+
* A closed one of an earlier branch of the same name, deleted since and
|
|
148
|
+
* pushed again, is not this branch's; nor is one from another repository (a
|
|
149
|
+
* fork's branch of that name). Undefined when there is none; a forge that
|
|
150
|
+
* cannot be asked is an error, never "none".
|
|
151
|
+
*/
|
|
152
|
+
export async function pullOf(ctx, consumer, dir, version, tip) {
|
|
153
|
+
const args = ['pr', 'list', '--head', versionBranch(version), '--base', consumer.branch, '--state', 'all'];
|
|
154
|
+
const fields = 'url,number,isDraft,state,author,headRefOid,isCrossRepository';
|
|
155
|
+
const out = await ctx.read('gh', [...args, '--limit', String(LISTED), '--json', fields], { cwd: dir });
|
|
156
|
+
let listed;
|
|
157
|
+
try {
|
|
158
|
+
listed = JSON.parse(out);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
throw new Error(`gh pr list gave no JSON for ${versionBranch(version)}`);
|
|
162
|
+
}
|
|
163
|
+
if (!Array.isArray(listed))
|
|
164
|
+
throw new Error(`gh pr list gave no list for ${versionBranch(version)}`);
|
|
165
|
+
const pulls = listed.flatMap((p) => {
|
|
166
|
+
if (typeof p !== 'object' || p === null)
|
|
167
|
+
return [];
|
|
168
|
+
const { url, number, isDraft, state, author, headRefOid, isCrossRepository } = p;
|
|
169
|
+
if (typeof url !== 'string' || typeof number !== 'number' || isCrossRepository !== false)
|
|
170
|
+
return [];
|
|
171
|
+
const login = author?.login;
|
|
172
|
+
return [
|
|
173
|
+
{
|
|
174
|
+
url,
|
|
175
|
+
number,
|
|
176
|
+
draft: isDraft === true,
|
|
177
|
+
open: state === 'OPEN',
|
|
178
|
+
...(typeof login === 'string' ? { author: login } : {}),
|
|
179
|
+
...(typeof headRefOid === 'string' ? { head: headRefOid } : {}),
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
});
|
|
183
|
+
const open = pulls.find((p) => p.open);
|
|
184
|
+
if (open)
|
|
185
|
+
return open;
|
|
186
|
+
return pulls.filter((p) => tip !== undefined && p.head === tip).sort((a, b) => b.number - a.number)[0];
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Ask the users for a review of the pull request, once; none asked, nothing
|
|
190
|
+
* done. The request is one call for every login, so its author, who opened
|
|
191
|
+
* it (a maintainer running the verb by hand who is among the reviewers), is
|
|
192
|
+
* left out first, and the narration says so.
|
|
193
|
+
*/
|
|
194
|
+
export async function askForReviews(ctx, name, pull, from, cwd) {
|
|
195
|
+
let named;
|
|
196
|
+
try {
|
|
197
|
+
named = 'named' in from ? from.named : reviewersOf(answersOf(from.answersFile));
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
const why = error.message;
|
|
201
|
+
ctx.say(` ✗ FAILED — ${name}: no review requested: ${why}`);
|
|
202
|
+
return { failed: why };
|
|
203
|
+
}
|
|
204
|
+
const author = pull.author?.toLowerCase();
|
|
205
|
+
const reviewers = named.filter((l) => l.toLowerCase() !== author);
|
|
206
|
+
if (reviewers.length < named.length)
|
|
207
|
+
ctx.say(`• ${name}: ${pull.author} opened the pull request and is not asked to review it`);
|
|
208
|
+
if (reviewers.length === 0)
|
|
209
|
+
return undefined;
|
|
210
|
+
try {
|
|
211
|
+
await ctx.apply([requestReviews(pull.number, reviewers, cwd)]);
|
|
212
|
+
return { requested: reviewers };
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
const why = detailOf(error);
|
|
216
|
+
ctx.say(` ✗ FAILED — ${name}: review request from ${reviewers.join(', ')}${why ? `: ${why}` : ''}`);
|
|
217
|
+
return { failed: why || 'the forge refused it' };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/** The hash of the branch's tip as origin has it, from `git ls-remote`. */
|
|
221
|
+
export async function tipOnOrigin(ctx, repo, branch) {
|
|
222
|
+
const tip = (await ctx.read('git', ['ls-remote', '--heads', 'origin', `refs/heads/${branch}`], { cwd: repo }))
|
|
223
|
+
.split('\t')[0]
|
|
224
|
+
?.trim();
|
|
225
|
+
if (!tip)
|
|
226
|
+
throw new Error(`origin no longer has ${branch}`);
|
|
227
|
+
return tip;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The commit's objects, fetched by hash with no ref, no FETCH_HEAD and no
|
|
231
|
+
* remote-tracking ref written. A later run needs the tip's tree only: in a
|
|
232
|
+
* shallow clone (CI's checkout) the tip comes alone, never the branch's
|
|
233
|
+
* history; a full clone is never made shallow by it.
|
|
234
|
+
*/
|
|
235
|
+
async function fetchTip(ctx, repo, tip) {
|
|
236
|
+
const shallow = (await ctx.read('git', ['rev-parse', '--is-shallow-repository'], { cwd: repo })).trim() === 'true';
|
|
237
|
+
// By hash, with no refmap: only the objects arrive; a fetch by name would move origin's remote-tracking ref.
|
|
238
|
+
await ctx.read('git', ['fetch', '--quiet', '--no-write-fetch-head', '--refmap=', ...(shallow ? ['--depth', '1'] : []), 'origin', tip], { cwd: repo });
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* How many commits the tip is ahead of the branch it is to land on, as the
|
|
242
|
+
* forge counts them (`ahead_by` of its compare, from their merge base, the
|
|
243
|
+
* count a pull request lists), never from local history, which a shallow or
|
|
244
|
+
* single-branch clone does not hold.
|
|
245
|
+
*/
|
|
246
|
+
async function aheadOf(ctx, consumer, tip) {
|
|
247
|
+
const out = await ctx.read('gh', ['api', `repos/{owner}/{repo}/compare/${consumer.branch}...${tip}`, '--jq', '.ahead_by'], { cwd: consumer.path });
|
|
248
|
+
const ahead = Number(out.trim());
|
|
249
|
+
if (out.trim() === '' || !Number.isInteger(ahead))
|
|
250
|
+
throw new Error(`the forge gave no count of commits for ${tip}`);
|
|
251
|
+
return ahead;
|
|
252
|
+
}
|
|
253
|
+
/** Whether anything in the state needs a hand. */
|
|
254
|
+
export const needsAHand = (p) => (p.conflicted?.length ?? 0) > 0 ||
|
|
255
|
+
p.marked.length > 0 ||
|
|
256
|
+
(p.failed?.length ?? 0) > 0 ||
|
|
257
|
+
(p.behind?.length ?? 0) > 0 ||
|
|
258
|
+
(p.lockfile === true && !p.checked);
|
|
259
|
+
const code = (s) => `\`${s}\``;
|
|
260
|
+
/**
|
|
261
|
+
* The copier update a human runs at a site to bring it to the version: the
|
|
262
|
+
* copier plx pins, at that version, never the newest tag (which, once a newer
|
|
263
|
+
* version is cut, would leave the site behind for good); trusted, as plx runs
|
|
264
|
+
* it; the questions answered already not asked again. Unlike plx's own run,
|
|
265
|
+
* new questions are asked and the template's tasks run: it is a developer's
|
|
266
|
+
* checkout.
|
|
267
|
+
*/
|
|
268
|
+
export const byHand = (version) => ['mise', ...copierVia(['update', '--trust', '--skip-answered', '--vcs-ref', version])].join(' ');
|
|
269
|
+
const site = (s) => (s === '.' ? 'the root' : code(s));
|
|
270
|
+
/** The body: what needs a hand first, then what the pull request is. */
|
|
271
|
+
export function pullBody(p) {
|
|
272
|
+
const hand = [
|
|
273
|
+
...(p.conflicted?.length
|
|
274
|
+
? [`- Conflicts at ${p.conflicted.map(site).join(', ')}, committed with their markers.`]
|
|
275
|
+
: []),
|
|
276
|
+
...(p.marked.length ? [`- Files that hold conflict markers: ${p.marked.map(code).join(', ')}.`] : []),
|
|
277
|
+
...(p.failed?.length
|
|
278
|
+
? [`- \`copier update\` failed at ${p.failed.map(site).join(', ')}, left as it was; run it there by hand.`]
|
|
279
|
+
: []),
|
|
280
|
+
...(p.behind ?? []).map((s) => `- The answers at ${site(s)} do not record ${p.version}: copier did not run here. On this branch, in ${site(s)}, run \`${byHand(p.version)}\` and commit what it changes.`),
|
|
281
|
+
...(p.lockfile && !p.checked
|
|
282
|
+
? ['- The lockfile did not refresh: run `pnpm install` after resolving, and commit the lockfile.']
|
|
283
|
+
: []),
|
|
284
|
+
];
|
|
285
|
+
// A later run cannot know whether the refresh failed; it asks for one where the branch may need it.
|
|
286
|
+
const lockfile = p.lockfile && p.checked ? ['- Run `pnpm install` once resolved, and commit the lockfile.'] : [];
|
|
287
|
+
const head = hand.length > 0
|
|
288
|
+
? `**Needs a hand.** \`plx update\` marks this pull request ready once no tracked file holds a conflict marker and every site's answers record the version.\n\n${[...hand, ...lockfile].join('\n')}`
|
|
289
|
+
: p.checked
|
|
290
|
+
? `Ready for review: no tracked file holds a conflict marker, and every site's answers record ${p.version}.${lockfile.length ? `\n\n${lockfile.join('\n')}` : ''}`
|
|
291
|
+
: 'Nothing needs a hand: every site merged clean.';
|
|
292
|
+
return [
|
|
293
|
+
head,
|
|
294
|
+
`Plexus ${p.version} (§ 1.5 PLX): \`copier update\` at ${p.sites.map(site).join(', ')}, the lockfile where manifests moved, and the workflow refs.`,
|
|
295
|
+
p.note,
|
|
296
|
+
].join('\n\n');
|
|
297
|
+
}
|
|
298
|
+
/** The last line of a body a later run rewrote. */
|
|
299
|
+
const REVISITED = "Opened by `plx update`; rewritten by a later run from what it found at the branch's tip.";
|
|
300
|
+
/**
|
|
301
|
+
* The version branch's tip, read by hash: the detector over its tracked
|
|
302
|
+
* files, and its sites, every answers file it holds that names a template,
|
|
303
|
+
* each at the version or not. The lockfile is asked for where the tip holds
|
|
304
|
+
* one and the pull request is not ready, or holds commits beyond the one plx
|
|
305
|
+
* made (somebody resolved by hand), as the forge counts them (`aheadOf`).
|
|
306
|
+
*/
|
|
307
|
+
async function readTip(ctx, consumer, version, tip) {
|
|
308
|
+
const repo = consumer.path;
|
|
309
|
+
await fetchTip(ctx, repo, tip);
|
|
310
|
+
const marked = await filesWithConflictMarkers(ctx, repo, tip);
|
|
311
|
+
const { files, sites: held } = await sitesOfTree(ctx, repo, tip);
|
|
312
|
+
const sites = held.map((s) => s.dir);
|
|
313
|
+
const behind = held.filter((s) => s.answers?.commit !== version).map((s) => s.dir);
|
|
314
|
+
const ready = marked.length === 0 && behind.length === 0;
|
|
315
|
+
// Somebody pushed to the branch: more commits than the one plx made. Asked only when it decides something.
|
|
316
|
+
const lockfile = files.includes('pnpm-lock.yaml') && (!ready || (await aheadOf(ctx, consumer, tip)) > 1);
|
|
317
|
+
return { tip, sites, marked, behind, ready, lockfile };
|
|
318
|
+
}
|
|
319
|
+
/** What a later run found at the tip, as the run names it. */
|
|
320
|
+
function foundAt(at, version) {
|
|
321
|
+
const n = at.marked.length;
|
|
322
|
+
const parts = [
|
|
323
|
+
...(n > 0 ? [`${n} file${n === 1 ? '' : 's'} still hold${n === 1 ? 's' : ''} conflict markers`] : []),
|
|
324
|
+
...(at.behind.length > 0 ? [`${at.behind.map(site).join(', ')} not at ${version}: copier did not run there`] : []),
|
|
325
|
+
];
|
|
326
|
+
return parts.length > 0 ? parts.join('; ') : `no conflict marker remains, and every site is at ${version}`;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* A later run over the version's pull request, open on origin: the branch's
|
|
330
|
+
* tip read as origin has it (`readTip`), the body rewritten to what it found
|
|
331
|
+
* there, and the pull request ready when no tracked file holds a conflict
|
|
332
|
+
* marker and every site records the version, a draft again while either
|
|
333
|
+
* fails. Under a dry run it changes nothing and says what it would do.
|
|
334
|
+
*/
|
|
335
|
+
export async function revisit(ctx, consumer, pull, version, tip) {
|
|
336
|
+
const { path: repo, rel: name } = consumer;
|
|
337
|
+
const branch = versionBranch(version);
|
|
338
|
+
const at = await readTip(ctx, consumer, version, tip);
|
|
339
|
+
const { marked, behind, ready } = at;
|
|
340
|
+
const body = pullBody({
|
|
341
|
+
version,
|
|
342
|
+
sites: at.sites,
|
|
343
|
+
marked,
|
|
344
|
+
behind,
|
|
345
|
+
lockfile: at.lockfile,
|
|
346
|
+
checked: true,
|
|
347
|
+
note: REVISITED,
|
|
348
|
+
});
|
|
349
|
+
const line = `• ${name}: ${branch} is on origin (${pull.url}); ${foundAt(at, version)}`;
|
|
350
|
+
// Back to a draft is said once the forge has answered: a forge without drafts leaves it ordinary.
|
|
351
|
+
const undo = !ready && !pull.draft;
|
|
352
|
+
if (!undo)
|
|
353
|
+
ctx.say(ready && pull.draft ? `${line} — ready for review` : line);
|
|
354
|
+
// The body is written, never read: what it says decides nothing.
|
|
355
|
+
try {
|
|
356
|
+
await ctx.apply([
|
|
357
|
+
run('gh', ['api', `repos/{owner}/{repo}/pulls/${pull.number}`, '--method', 'PATCH', '-f', `body=${body}`], {
|
|
358
|
+
cwd: repo,
|
|
359
|
+
}),
|
|
360
|
+
...(ready && pull.draft ? [run('gh', ['pr', 'ready', pull.url], { cwd: repo })] : []),
|
|
361
|
+
]);
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
if (undo)
|
|
365
|
+
ctx.say(line);
|
|
366
|
+
return { url: pull.url, marked, behind, mergeable: false, failed: `pull request ${pull.url}: ${detailOf(error)}` };
|
|
367
|
+
}
|
|
368
|
+
// A forge that refuses the draft leaves the pull request ordinary: what needs a hand keeps the run nonzero.
|
|
369
|
+
if (undo)
|
|
370
|
+
await ctx.apply([run('gh', ['pr', 'ready', pull.url, '--undo'], { cwd: repo })]).then(() => ctx.say(`${line} — a draft again`), (error) => {
|
|
371
|
+
const why = detailOf(error);
|
|
372
|
+
ctx.say(`${line} — no draft: the forge refused one${why ? ` (${why})` : ''}`);
|
|
373
|
+
});
|
|
374
|
+
// A dry run left the state as it was.
|
|
375
|
+
const draft = ctx.dryRun ? pull.draft : !ready;
|
|
376
|
+
return { url: pull.url, marked, behind, mergeable: ready && !draft };
|
|
377
|
+
}
|
|
378
|
+
/** The last line of a body a later run opened. */
|
|
379
|
+
const OPENED_LATE = 'Opened by `plx update`: a later run found the branch on origin with no pull request.';
|
|
380
|
+
/**
|
|
381
|
+
* A later run that finds the version branch on origin and no pull request of
|
|
382
|
+
* it opens one: the branch's tip read as origin has it (`readTip`), a draft
|
|
383
|
+
* unless no tracked file holds a conflict marker and every site records the
|
|
384
|
+
* version, with the review request. Under a dry run it opens nothing and says
|
|
385
|
+
* that it would.
|
|
386
|
+
*/
|
|
387
|
+
export async function openLate(ctx, consumer, version, reviewers, tip) {
|
|
388
|
+
const { path: repo, rel: name } = consumer;
|
|
389
|
+
const branch = versionBranch(version);
|
|
390
|
+
const at = await readTip(ctx, consumer, version, tip);
|
|
391
|
+
const { marked, behind, ready } = at;
|
|
392
|
+
const state = {
|
|
393
|
+
version,
|
|
394
|
+
sites: at.sites,
|
|
395
|
+
marked,
|
|
396
|
+
behind,
|
|
397
|
+
lockfile: at.lockfile,
|
|
398
|
+
checked: true,
|
|
399
|
+
note: OPENED_LATE,
|
|
400
|
+
};
|
|
401
|
+
const asDraft = !ready;
|
|
402
|
+
ctx.say(`• ${name}: ${branch} is on origin with no pull request — opening it${asDraft ? ' as a draft' : ''}`);
|
|
403
|
+
let draft;
|
|
404
|
+
try {
|
|
405
|
+
draft = await createPull(ctx, name, { base: consumer.branch, version, body: pullBody(state), draft: asDraft }, repo);
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
const why = detailOf(error);
|
|
409
|
+
ctx.say(` ✗ FAILED — pull request${why ? `: ${why}` : ''}`);
|
|
410
|
+
return { marked, behind, ready, failed: `pull request: ${why}` };
|
|
411
|
+
}
|
|
412
|
+
if (ctx.dryRun) {
|
|
413
|
+
ctx.say(` (preview) ${name}: would open a pull request of ${branch} against ${consumer.branch}`);
|
|
414
|
+
return { marked, behind, ready, previewed: true };
|
|
415
|
+
}
|
|
416
|
+
const pull = await pullOf(ctx, consumer, repo, version);
|
|
417
|
+
if (!pull)
|
|
418
|
+
return { marked, behind, ready, failed: 'pull request: the forge did not list it after opening it' };
|
|
419
|
+
ctx.say(`• ${name}: ${draft ? 'draft ' : ''}pull request opened: ${pull.url}`);
|
|
420
|
+
// Unless named, from the root answers as the branch has them.
|
|
421
|
+
const from = reviewers ?? {
|
|
422
|
+
answersFile: await ctx
|
|
423
|
+
.read('git', ['cat-file', 'blob', `${at.tip}:${ANSWERS_FILE}`], { cwd: repo })
|
|
424
|
+
.catch(() => ''),
|
|
425
|
+
};
|
|
426
|
+
const review = await askForReviews(ctx, name, pull, from, repo);
|
|
427
|
+
return { pull, marked, behind, ready, ...(review ? { review } : {}) };
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=pull.js.map
|
package/dist/pull.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../src/pull.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,iDAAiD;AACjD,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,gEAAgE;AAChE,wEAAwE;AACxE,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,yEAAyE;AACzE,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,uEAAuE;AACvE,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,+EAA+E;AAC/E,0EAA0E;AAC1E,QAAQ;AACR,EAAE;AACF,sEAAsE;AACtE,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,wCAAwC;AACxC,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,0DAA0D;AAC1D,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAC7E,oEAAoE;AACpE,OAA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AAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAChE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from './context.ts';
|
|
2
|
+
import { type Outcome, type UpdateOptions } from './update.ts';
|
|
3
|
+
export interface RecursiveOptions extends Omit<UpdateOptions, 'repo' | 'name'> {
|
|
4
|
+
/** The directory the repos sit under, at any depth. */
|
|
5
|
+
dir: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function updateRecursive(ctx: Context, options: RecursiveOptions): Promise<Outcome[]>;
|
|
8
|
+
//# sourceMappingURL=recursive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursive.d.ts","sourceRoot":"","sources":["../src/recursive.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,OAAO,EAAE,KAAK,OAAO,EAAc,KAAK,aAAa,EAAU,MAAM,aAAa,CAAC;AAGnF,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5E,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CA6BjG"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// update --recursive: `update` in every repo generated from the templates
|
|
2
|
+
// under a directory, at any depth (§ 3 PLX-Updates). The operator's
|
|
3
|
+
// convenience over the verb, for whoever has many repos checked out side by
|
|
4
|
+
// side, the maintainers or a tenant's own operator: it needs no checkout of
|
|
5
|
+
// the upstream, reads the published versions like `update` does, and decides
|
|
6
|
+
// each repo by the same rule: a patch at once, a minor at the repo's next
|
|
7
|
+
// scheduled pull, a major only when asked. A repo that takes nothing rests;
|
|
8
|
+
// `now` or a named version asks for every repo at once.
|
|
9
|
+
//
|
|
10
|
+
// What every repo would read alike is read once: the directory is walked
|
|
11
|
+
// once, the login checked once, and the versions listed once, then handed to
|
|
12
|
+
// `update` (update.ts) with each repo as the walk found it. Each repo is
|
|
13
|
+
// updated in a worktree of the branch the version lands on, so the checkouts
|
|
14
|
+
// stay as they are. Nothing aborts the run: a repo that fails is recorded and
|
|
15
|
+
// the rest continues; the outcomes, one per repo, say what rests, what is
|
|
16
|
+
// clean, conflicted or failed, and the pull requests.
|
|
17
|
+
//
|
|
18
|
+
// plx update --recursive ~/dev # every repo, the version its schedule takes
|
|
19
|
+
// plx update -r ~/dev --now # every repo, the newest version whatever its step
|
|
20
|
+
// plx -n update -r ~/dev --now # preview in worktrees, push nothing
|
|
21
|
+
// plx -y update -r ~/dev --to 0.66.0
|
|
22
|
+
import { findConsumers } from "./consumers.js";
|
|
23
|
+
import { detailOf } from "./io.js";
|
|
24
|
+
import { overview } from "./overview.js";
|
|
25
|
+
import { TEMPLATES, templateSource } from "./templates.js";
|
|
26
|
+
import { releasesOf, update } from "./update.js";
|
|
27
|
+
import { isPlexusVersion, preflightForge, UsageError } from "./version.js";
|
|
28
|
+
export async function updateRecursive(ctx, options) {
|
|
29
|
+
const { dir, ...rest } = options;
|
|
30
|
+
if (options.to !== undefined && !isPlexusVersion(options.to))
|
|
31
|
+
throw new UsageError(`'${options.to}' is not plain semver (X.Y.Z, no v)`);
|
|
32
|
+
const consumers = await findConsumers(ctx, await overview(ctx, dir), TEMPLATES);
|
|
33
|
+
if (consumers.length === 0)
|
|
34
|
+
ctx.say(`• no repo generated from ${TEMPLATES.map(templateSource).join(', ')} found under ${dir}`);
|
|
35
|
+
let releases = [];
|
|
36
|
+
if (consumers.some((c) => !c.skipped)) {
|
|
37
|
+
await preflightForge(ctx);
|
|
38
|
+
if (options.to === undefined)
|
|
39
|
+
releases = await releasesOf(ctx);
|
|
40
|
+
}
|
|
41
|
+
const version = options.to ?? '';
|
|
42
|
+
const outcomes = [];
|
|
43
|
+
for (const consumer of consumers) {
|
|
44
|
+
if (consumer.skipped) {
|
|
45
|
+
ctx.say(`⚠ ${consumer.rel}: ${consumer.skipped} — skipped (fix it, then re-run plx update --recursive)`);
|
|
46
|
+
outcomes.push({ repo: consumer.rel, version, kind: 'skipped', reason: consumer.skipped });
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
outcomes.push(await update(ctx, { repo: consumer.path, ...rest }, { consumer, releases }));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const why = detailOf(error);
|
|
54
|
+
ctx.say(` ✗ FAILED — ${consumer.rel}${why ? `: ${why}` : ''}`);
|
|
55
|
+
outcomes.push({ repo: consumer.rel, version, kind: 'failed', detail: why });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return outcomes;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=recursive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursive.js","sourceRoot":"","sources":["../src/recursive.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oEAAoE;AACpE,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,wDAAwD;AACxD,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,0EAA0E;AAC1E,sDAAsD;AACtD,EAAE;AACF,4FAA4F;AAC5F,kGAAkG;AAClG,oFAAoF;AACpF,uCAAuC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAA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/** True for a dry run: nothing in the workspace changed. */
|
|
5
|
+
preview: boolean;
|
|
6
|
+
/** Sites, relative to the workspace. */
|
|
7
|
+
clean: string[];
|
|
8
|
+
/** Sites left with conflicts, and files that hold conflict markers outside them: in a pull request opened, or on a version branch found on origin. */
|
|
9
|
+
conflicted: string[];
|
|
10
|
+
/** Sites whose update exited nonzero or, on a version branch found on origin, whose answers do not record the version; consumers that could not be cloned or pushed, lockfiles that failed to refresh, and review requests the forge refused. */
|
|
11
|
+
failed: string[];
|
|
12
|
+
/** Consumers left untouched, with the reason. */
|
|
13
|
+
skipped: {
|
|
14
|
+
path: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}[];
|
|
17
|
+
/** Repos that need no version yet and rest on the one they have (need.ts), with what would end the rest. */
|
|
18
|
+
resting: {
|
|
19
|
+
path: string;
|
|
20
|
+
reason: string;
|
|
21
|
+
}[];
|
|
22
|
+
/** The pull requests opened or found, one per consumer that changed. */
|
|
23
|
+
pulls: string[];
|
|
24
|
+
/** Those of `pulls` that are no draft and need no hand: ready to merge once their checks pass. */
|
|
25
|
+
mergeable: string[];
|
|
26
|
+
/** The version branches on origin with no pull request that a dry run would open one of. */
|
|
27
|
+
opening: string[];
|
|
28
|
+
}
|
|
29
|
+
/** True when nothing in the summary needs a human but the pull requests. */
|
|
30
|
+
export declare const isClean: (s: Summary) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The summary of what the repos' runs came to, in their order. Its version is
|
|
33
|
+
* the one given, else the first a run names.
|
|
34
|
+
*/
|
|
35
|
+
export declare function summarize(outcomes: readonly Outcome[], preview: boolean, version?: string): Summary;
|
|
2
36
|
/**
|
|
3
37
|
* One line to paste that merges the given pull requests, each with a merge
|
|
4
38
|
* commit and its branch deleted: `gh pr merge -md -R <org>/<repo> <number>`,
|
package/dist/summary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sJAAsJ;IACtJ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iPAAiP;IACjP,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,iDAAiD;IACjD,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,4GAA4G;IAC5G,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,kGAAkG;IAClG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,4FAA4F;IAC5F,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAKD,4EAA4E;AAC5E,eAAO,MAAM,OAAO,GAAI,GAAG,OAAO,KAAG,OACyC,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,SAAiD,GACvD,OAAO,CA4DT;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAMhD;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,SAAW,GAAG,MAAM,CAsBtF"}
|