@plexus-ms/lib 0.130.0 → 0.132.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 (109) hide show
  1. package/dist/apply.d.ts +25 -0
  2. package/dist/apply.d.ts.map +1 -0
  3. package/dist/apply.js +204 -0
  4. package/dist/apply.js.map +1 -0
  5. package/dist/bookkeeping.js +3 -3
  6. package/dist/bookkeeping.js.map +1 -1
  7. package/dist/bundled.d.ts +15 -0
  8. package/dist/bundled.d.ts.map +1 -0
  9. package/dist/bundled.js +42 -0
  10. package/dist/bundled.js.map +1 -0
  11. package/dist/changeset.js +3 -3
  12. package/dist/changeset.js.map +1 -1
  13. package/dist/consumers.d.ts +6 -35
  14. package/dist/consumers.d.ts.map +1 -1
  15. package/dist/consumers.js +45 -83
  16. package/dist/consumers.js.map +1 -1
  17. package/dist/doctor.d.ts +17 -1
  18. package/dist/doctor.d.ts.map +1 -1
  19. package/dist/doctor.js +167 -11
  20. package/dist/doctor.js.map +1 -1
  21. package/dist/engine.d.ts +2 -0
  22. package/dist/engine.d.ts.map +1 -0
  23. package/dist/engine.js +9 -0
  24. package/dist/engine.js.map +1 -0
  25. package/dist/frontmatter.d.ts.map +1 -1
  26. package/dist/frontmatter.js +6 -5
  27. package/dist/frontmatter.js.map +1 -1
  28. package/dist/index.d.ts +13 -8
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +14 -9
  31. package/dist/index.js.map +1 -1
  32. package/dist/io.d.ts +1 -1
  33. package/dist/marker.d.ts +38 -0
  34. package/dist/marker.d.ts.map +1 -1
  35. package/dist/marker.js +269 -16
  36. package/dist/marker.js.map +1 -1
  37. package/dist/model.d.ts +15 -17
  38. package/dist/model.d.ts.map +1 -1
  39. package/dist/model.js +19 -21
  40. package/dist/model.js.map +1 -1
  41. package/dist/need.d.ts +1 -1
  42. package/dist/need.d.ts.map +1 -1
  43. package/dist/need.js +2 -2
  44. package/dist/need.js.map +1 -1
  45. package/dist/newSite.d.ts +31 -0
  46. package/dist/newSite.d.ts.map +1 -0
  47. package/dist/newSite.js +184 -0
  48. package/dist/newSite.js.map +1 -0
  49. package/dist/overview.d.ts +5 -9
  50. package/dist/overview.d.ts.map +1 -1
  51. package/dist/overview.js +26 -51
  52. package/dist/overview.js.map +1 -1
  53. package/dist/pull.d.ts +48 -21
  54. package/dist/pull.d.ts.map +1 -1
  55. package/dist/pull.js +183 -67
  56. package/dist/pull.js.map +1 -1
  57. package/dist/recursive.d.ts.map +1 -1
  58. package/dist/recursive.js +7 -5
  59. package/dist/recursive.js.map +1 -1
  60. package/dist/requirements.d.ts +1 -1
  61. package/dist/requirements.d.ts.map +1 -1
  62. package/dist/requirements.js +11 -13
  63. package/dist/requirements.js.map +1 -1
  64. package/dist/siteTemplates.d.ts +14 -0
  65. package/dist/siteTemplates.d.ts.map +1 -0
  66. package/dist/siteTemplates.js +107 -0
  67. package/dist/siteTemplates.js.map +1 -0
  68. package/dist/sites.d.ts +24 -0
  69. package/dist/sites.d.ts.map +1 -0
  70. package/dist/sites.js +89 -0
  71. package/dist/sites.js.map +1 -0
  72. package/dist/standard-index.json +1 -1
  73. package/dist/summary.d.ts +1 -1
  74. package/dist/summary.d.ts.map +1 -1
  75. package/dist/summary.js +6 -1
  76. package/dist/summary.js.map +1 -1
  77. package/dist/sync.d.ts +86 -0
  78. package/dist/sync.d.ts.map +1 -0
  79. package/dist/sync.js +227 -0
  80. package/dist/sync.js.map +1 -0
  81. package/dist/take.d.ts +20 -25
  82. package/dist/take.d.ts.map +1 -1
  83. package/dist/take.js +48 -142
  84. package/dist/take.js.map +1 -1
  85. package/dist/templatesRoot.d.ts +5 -0
  86. package/dist/templatesRoot.d.ts.map +1 -0
  87. package/dist/templatesRoot.js +37 -0
  88. package/dist/templatesRoot.js.map +1 -0
  89. package/dist/update.d.ts +48 -10
  90. package/dist/update.d.ts.map +1 -1
  91. package/dist/update.js +173 -78
  92. package/dist/update.js.map +1 -1
  93. package/dist/version.d.ts +2 -2
  94. package/dist/version.d.ts.map +1 -1
  95. package/dist/version.js +2 -8
  96. package/dist/version.js.map +1 -1
  97. package/dist/versionTemplates.d.ts +24 -0
  98. package/dist/versionTemplates.d.ts.map +1 -0
  99. package/dist/versionTemplates.js +168 -0
  100. package/dist/versionTemplates.js.map +1 -0
  101. package/package.json +2 -1
  102. package/dist/copier.d.ts +0 -17
  103. package/dist/copier.d.ts.map +0 -1
  104. package/dist/copier.js +0 -35
  105. package/dist/copier.js.map +0 -1
  106. package/dist/templates.d.ts +0 -21
  107. package/dist/templates.d.ts.map +0 -1
  108. package/dist/templates.js +0 -55
  109. package/dist/templates.js.map +0 -1
package/dist/pull.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Consumer } from './consumers.ts';
1
+ import type { Consumer } from './consumers.ts';
2
2
  import type { Context } from './context.ts';
3
3
  export declare const versionBranch: (version: string) => string;
4
4
  /** The answer of the repo templates that names who reviews the version's pull requests. */
@@ -9,6 +9,19 @@ export declare const REVIEWERS_ANSWER = "pr_reviewers";
9
9
  * anything else is refused, naming where it came from.
10
10
  */
11
11
  export declare function parseReviewers(value: string, what: string): string[];
12
+ /** The repo's `plx` pin where it does not name the version: the version it pins, or none at all. */
13
+ export interface PinGap {
14
+ pin?: string;
15
+ }
16
+ /**
17
+ * The gap between the version and the `plx` pin, from the texts of the root
18
+ * marker and the root `mise.toml` (undefined where there is none): only where
19
+ * the root marker names the version, since a root marker that does not is a
20
+ * gap of its own; none where the pin names it too.
21
+ */
22
+ export declare function pinGap(version: string, marker: string | undefined, mise: string | undefined): PinGap | undefined;
23
+ /** The pin gap as the run and the body name it. */
24
+ export declare const pinSaid: (gap: PinGap, version: string) => string;
12
25
  /** The reviewers a repo's root answers name; none when they name none. */
13
26
  export declare function reviewersOf(answers: Record<string, unknown>): string[];
14
27
  /** The request for reviews from users on a pull request, by its number, in the repo `cwd` belongs to. */
@@ -57,15 +70,15 @@ export type Review = {
57
70
  failed: string;
58
71
  };
59
72
  /**
60
- * Who is asked to review: the logins named (`--reviewer`), or the root
61
- * answers file as the pull request's branch has it, after copier ran at every
62
- * site, whose `pr_reviewers` is read, and checked, only when a pull request is
63
- * opened.
73
+ * Who is asked to review: the logins named (`--reviewer`), or the text of the
74
+ * root marker as the pull request's branch has it, once the sites are at the
75
+ * version, whose `pr_reviewers` is read, and checked, only when a pull request
76
+ * is opened.
64
77
  */
65
78
  export type Reviewers = {
66
79
  named: string[];
67
80
  } | {
68
- answersFile: string;
81
+ marker: string;
69
82
  };
70
83
  /**
71
84
  * Ask the users for a review of the pull request, once; none asked, nothing
@@ -76,19 +89,39 @@ export type Reviewers = {
76
89
  export declare function askForReviews(ctx: Context, name: string, pull: Pull, from: Reviewers, cwd: string): Promise<Review | undefined>;
77
90
  /** The hash of the branch's tip as origin has it, from `git ls-remote`. */
78
91
  export declare function tipOnOrigin(ctx: Context, repo: string, branch: string): Promise<string>;
92
+ /**
93
+ * The message of the commit by which a repo takes the version: its subject,
94
+ * then for each site the paths left conflicted with their markers and the
95
+ * files the version drops that were edited here, kept without markers, one
96
+ * block each. A later run reads the second kind back (`keptIn`), since no
97
+ * marker shows them; the first it finds by the detector.
98
+ */
99
+ export declare function commitMessage(version: string, sites: readonly {
100
+ dir: string;
101
+ conflicts?: readonly string[];
102
+ kept?: readonly string[];
103
+ }[]): string;
104
+ /** The kept files a commit message of `commitMessage` names, by site. */
105
+ export declare function keptIn(message: string): Record<string, string[]>;
79
106
  /** What a pull request's body says, as data. */
80
107
  export interface PullState {
81
108
  version: string;
82
109
  /** The sites, relative to the repo (`.` for its root). */
83
110
  sites: string[];
84
- /** Sites where copier left a conflict. */
111
+ /** Sites the merge left with a conflict. */
85
112
  conflicted?: string[];
86
113
  /** Tracked files that hold a conflict marker, relative to the repo. */
87
114
  marked: string[];
88
- /** Sites whose copier run failed, left as they were. */
115
+ /** Sites whose step failed, left as they were. */
89
116
  failed?: string[];
90
- /** Sites whose answers do not record the version: copier did not run there. */
117
+ /** Not at the version: the root (`.`) when the root marker does not name it. */
91
118
  behind?: string[];
119
+ /** By site, the paths the merge left with markers in them, where they are known. */
120
+ conflicts?: Readonly<Record<string, readonly string[]>>;
121
+ /** By site, the edited files the version drops, kept without markers: no hand needed, but a reviewer is told. */
122
+ kept?: Readonly<Record<string, readonly string[]>>;
123
+ /** The root marker names the version, and the `plx` pin does not. */
124
+ pin?: PinGap;
92
125
  /** The opening run: the lockfile refresh failed. A later run: run `pnpm install` and commit the lockfile. */
93
126
  lockfile?: boolean;
94
127
  /** Written by a later run from what it checked at the branch's tip, not by the run that opened it. */
@@ -98,15 +131,6 @@ export interface PullState {
98
131
  }
99
132
  /** Whether anything in the state needs a hand. */
100
133
  export declare const needsAHand: (p: PullState) => boolean;
101
- /**
102
- * The copier update a human runs at a site to bring it to the version: the
103
- * copier plx pins, at that version, never the newest tag (which, once a newer
104
- * version is cut, would leave the site behind for good); trusted, as plx runs
105
- * it; the questions answered already not asked again. Unlike plx's own run,
106
- * new questions are asked and the template's tasks run: it is a developer's
107
- * checkout.
108
- */
109
- export declare const byHand: (version: string) => string;
110
134
  /** The body: what needs a hand first, then what the pull request is. */
111
135
  export declare function pullBody(p: PullState): string;
112
136
  /** What a later run found of a pull request on origin, and did to it. */
@@ -114,9 +138,11 @@ export interface Revisited {
114
138
  url: string;
115
139
  /** Tracked files of the branch that hold a conflict marker. */
116
140
  marked: string[];
117
- /** Sites of the branch whose answers do not record the version. */
141
+ /** The root, when the root marker of the branch does not name the version. */
118
142
  behind: string[];
119
- /** Ready to merge once its checks pass: no longer a draft, no marker left, every site at the version. */
143
+ /** The root marker of the branch names the version, and its `plx` pin does not. */
144
+ pin?: PinGap;
145
+ /** Ready to merge once its checks pass: no longer a draft, no marker left, every site at the version, the pin too. */
120
146
  mergeable: boolean;
121
147
  /** Why the rewrite or the change of state failed, when one did. */
122
148
  failed?: string;
@@ -137,7 +163,8 @@ export interface OpenedLate {
137
163
  previewed?: true;
138
164
  marked: string[];
139
165
  behind: string[];
140
- /** No marker, and every site at the version. */
166
+ pin?: PinGap;
167
+ /** No marker, every site at the version, and the pin too. */
141
168
  ready: boolean;
142
169
  review?: Review;
143
170
  failed?: string;
@@ -1 +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;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAuC5G;AAED,sEAAsE;AACtE,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,C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OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,CAAC,CA8CrB"}
package/dist/pull.js CHANGED
@@ -5,9 +5,9 @@
5
5
  //
6
6
  // A pull request that needs a hand is asked for as a draft, and its body
7
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
8
+ // hold conflict markers (conflicts.ts), the sites whose step failed, and,
9
+ // when the lockfile did not refresh, that `pnpm install` is to be run after
10
+ // resolving. Where the forge refuses a draft, the same pull request is
11
11
  // opened as an ordinary one, and the run says so; it needs a hand all the
12
12
  // same. One that needs none is ready for review.
13
13
  //
@@ -17,9 +17,15 @@
17
17
  // that commit fetched by hash with no ref, no FETCH_HEAD and no
18
18
  // remote-tracking ref written, so no checkout and no ref of the repo is
19
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
20
+ // that no tracked file holds a conflict marker, and that the root marker
21
+ // names the version (`version`, which `update` writes with the templates, so
22
+ // that every site of the repo is at it); a root marker that does not, or that
23
+ // cannot be read, is not at it. Where the root marker names the version, the
24
+ // repo's `plx` pin (the root `mise.toml`, read as the overview reads it) must
25
+ // name it too: `plx update` moves the pin with the version only where the
26
+ // pin's line of a template's `mise.toml` merges, and a pin left behind, or
27
+ // gone, is said in a line of its own, at opening as at every later visit, and
28
+ // keeps the pull request waiting. All hold: the pull request is ready. It
23
29
  // writes the body afresh for what it checked (it never reads the body), and
24
30
  // marks the pull request ready, or a draft again while either fails; a forge
25
31
  // that refuses the draft leaves it ordinary, which the run says and does not
@@ -41,17 +47,19 @@
41
47
  // one from a fork's branch of the name.
42
48
  //
43
49
  // 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.
50
+ // not, from the users the root marker names as the pull request's branch has
51
+ // it, once the sites are at the version (`pr_reviewers`, a comma-separated
52
+ // string of GitHub user logins, empty or absent for none), or those
53
+ // `--reviewer` names instead; nothing more when it is marked ready.
48
54
  // Users only: a team is refused. The request is one call for all of them, so
49
55
  // the pull request's author is left out of it, and the run says so.
50
56
  import { filesWithConflictMarkers } from "./conflicts.js";
51
- import { sitesOfTree } from "./consumers.js";
52
- import { ANSWERS_FILE, copierVia, parseAnswers } from "./copier.js";
53
57
  import { run } from "./effects.js";
54
58
  import { detailOf } from "./io.js";
59
+ import { MARKER_FILE, parseMarkerConfig } from "./marker.js";
60
+ import { MISE_FILE } from "./overview.js";
61
+ import { findSites } from "./sites.js";
62
+ import { plxPinOf } from "./version.js";
55
63
  export const versionBranch = (version) => `plexus/${version}`;
56
64
  /** The answer of the repo templates that names who reviews the version's pull requests. */
57
65
  export const REVIEWERS_ANSWER = 'pr_reviewers';
@@ -73,17 +81,42 @@ export function parseReviewers(value, what) {
73
81
  }
74
82
  return [...new Set(logins)];
75
83
  }
76
- /** A root answers file's answers; a file that is not YAML, or empty, is refused with what it is. */
84
+ /** A root marker's answers; a marker that cannot be read as configuration, or is empty, is refused with what it is. */
77
85
  function answersOf(text) {
78
86
  if (text.trim() === '')
79
- throw new Error(`the root ${ANSWERS_FILE} is empty or missing`);
87
+ throw new Error(`the root ${MARKER_FILE} is empty or missing`);
80
88
  try {
81
- return parseAnswers(text).answers;
89
+ return parseMarkerConfig(text).answers;
82
90
  }
83
91
  catch (error) {
84
- throw new Error(`the root ${ANSWERS_FILE} cannot be read: ${error.message.split('\n')[0]}`);
92
+ throw new Error(`the root ${MARKER_FILE} cannot be read: ${error.message.split('\n')[0]}`);
85
93
  }
86
94
  }
95
+ /**
96
+ * The gap between the version and the `plx` pin, from the texts of the root
97
+ * marker and the root `mise.toml` (undefined where there is none): only where
98
+ * the root marker names the version, since a root marker that does not is a
99
+ * gap of its own; none where the pin names it too.
100
+ */
101
+ export function pinGap(version, marker, mise) {
102
+ let named;
103
+ try {
104
+ named = marker !== undefined && parseMarkerConfig(marker).version === version;
105
+ }
106
+ catch {
107
+ named = false;
108
+ }
109
+ if (!named)
110
+ return undefined;
111
+ const pin = mise === undefined ? undefined : plxPinOf(mise);
112
+ if (pin === version)
113
+ return undefined;
114
+ return pin === undefined ? {} : { pin };
115
+ }
116
+ /** The pin gap as the run and the body name it. */
117
+ export const pinSaid = (gap, version) => gap.pin === undefined
118
+ ? `the root \`${MISE_FILE}\` pins no plx`
119
+ : `the root \`${MISE_FILE}\` pins plx ${gap.pin}, not ${version}`;
87
120
  /** The reviewers a repo's root answers name; none when they name none. */
88
121
  export function reviewersOf(answers) {
89
122
  const value = answers[REVIEWERS_ANSWER];
@@ -194,7 +227,7 @@ export async function pullOf(ctx, consumer, dir, version, tip) {
194
227
  export async function askForReviews(ctx, name, pull, from, cwd) {
195
228
  let named;
196
229
  try {
197
- named = 'named' in from ? from.named : reviewersOf(answersOf(from.answersFile));
230
+ named = 'named' in from ? from.named : reviewersOf(answersOf(from.marker));
198
231
  }
199
232
  catch (error) {
200
233
  const why = error.message;
@@ -238,46 +271,99 @@ async function fetchTip(ctx, repo, tip) {
238
271
  await ctx.read('git', ['fetch', '--quiet', '--no-write-fetch-head', '--refmap=', ...(shallow ? ['--depth', '1'] : []), 'origin', tip], { cwd: repo });
239
272
  }
240
273
  /**
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.
274
+ * How many commits the tip is ahead of the branch it is to land on, and the
275
+ * message of the first of them, the one plx made, as the forge has them (its
276
+ * compare, from their merge base: the count and the commits a pull request
277
+ * lists), never from local history, which a shallow or single-branch clone
278
+ * does not hold.
245
279
  */
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))
280
+ async function comparedAt(ctx, consumer, tip) {
281
+ const out = await ctx.read('gh', [
282
+ 'api',
283
+ `repos/{owner}/{repo}/compare/${consumer.branch}...${tip}`,
284
+ '--jq',
285
+ '.ahead_by, (.commits[0].commit.message // "")',
286
+ ], { cwd: consumer.path });
287
+ const [count = '', ...message] = out.split('\n');
288
+ const ahead = Number(count.trim());
289
+ if (count.trim() === '' || !Number.isInteger(ahead))
250
290
  throw new Error(`the forge gave no count of commits for ${tip}`);
251
- return ahead;
291
+ return { ahead, message: message.join('\n').trim() };
292
+ }
293
+ /** A site as the commit message names it. */
294
+ const siteIn = (dir) => (dir === '.' ? 'the root' : dir);
295
+ const KEPT = (version) => `Kept although ${version} drops them, since they were edited here`;
296
+ /**
297
+ * The message of the commit by which a repo takes the version: its subject,
298
+ * then for each site the paths left conflicted with their markers and the
299
+ * files the version drops that were edited here, kept without markers, one
300
+ * block each. A later run reads the second kind back (`keptIn`), since no
301
+ * marker shows them; the first it finds by the detector.
302
+ */
303
+ export function commitMessage(version, sites) {
304
+ const block = (head, paths) => paths && paths.length > 0 ? [`${head}:\n${paths.map((p) => `- ${p}`).join('\n')}`] : [];
305
+ return [
306
+ `chore: Plexus ${version}`,
307
+ ...sites.flatMap((s) => [
308
+ ...block(`Conflicted, committed with their markers, at ${siteIn(s.dir)}`, s.conflicts),
309
+ ...block(`${KEPT(version)}, at ${siteIn(s.dir)}`, s.kept),
310
+ ]),
311
+ ].join('\n\n');
312
+ }
313
+ /** The kept files a commit message of `commitMessage` names, by site. */
314
+ export function keptIn(message) {
315
+ const kept = {};
316
+ let site;
317
+ for (const line of message.split('\n')) {
318
+ const head = /^Kept although \S+ drops them, since they were edited here, at (.+):$/.exec(line);
319
+ if (head?.[1]) {
320
+ site = head[1] === 'the root' ? '.' : head[1];
321
+ kept[site] = [];
322
+ }
323
+ else if (site !== undefined && line.startsWith('- '))
324
+ kept[site]?.push(line.slice(2));
325
+ else
326
+ site = undefined;
327
+ }
328
+ return kept;
252
329
  }
253
330
  /** Whether anything in the state needs a hand. */
254
331
  export const needsAHand = (p) => (p.conflicted?.length ?? 0) > 0 ||
255
332
  p.marked.length > 0 ||
256
333
  (p.failed?.length ?? 0) > 0 ||
257
334
  (p.behind?.length ?? 0) > 0 ||
335
+ p.pin !== undefined ||
258
336
  (p.lockfile === true && !p.checked);
259
337
  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(' ');
338
+ const capital = (s) => `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
269
339
  const site = (s) => (s === '.' ? 'the root' : code(s));
270
340
  /** The body: what needs a hand first, then what the pull request is. */
271
341
  export function pullBody(p) {
272
342
  const hand = [
273
- ...(p.conflicted?.length
274
- ? [`- Conflicts at ${p.conflicted.map(site).join(', ')}, committed with their markers.`]
275
- : []),
343
+ ...(p.conflicted ?? []).map((s) => {
344
+ const paths = p.conflicts?.[s] ?? [];
345
+ if (paths.length > 0)
346
+ return `- Conflicts at ${site(s)}, committed with their markers: ${paths.map(code).join(', ')}.`;
347
+ if ((p.kept?.[s]?.length ?? 0) > 0)
348
+ return `- Conflicts at ${site(s)}: files ${p.version} drops were edited here, and are kept, as listed below.`;
349
+ return `- Conflicts at ${site(s)}, committed with their markers.`;
350
+ }),
276
351
  ...(p.marked.length ? [`- Files that hold conflict markers: ${p.marked.map(code).join(', ')}.`] : []),
277
352
  ...(p.failed?.length
278
- ? [`- \`copier update\` failed at ${p.failed.map(site).join(', ')}, left as it was; run it there by hand.`]
353
+ ? [
354
+ `- The templates were not applied at ${p.failed.map(site).join(', ')}, left as it was; the run's log says why.`,
355
+ ]
356
+ : []),
357
+ ...((p.behind?.length ?? 0) > 0
358
+ ? [
359
+ `- The root \`${MARKER_FILE}\` does not name version ${p.version}, which \`plx update\` writes with the templates: restore it, or delete this branch and run \`plx update --to ${p.version}\` again.`,
360
+ ]
361
+ : []),
362
+ ...(p.pin
363
+ ? [
364
+ `- ${capital(pinSaid(p.pin, p.version))}: pin plx at ${p.version} there; \`plx update\` moves the pin with the version only where its line merges.`,
365
+ ]
279
366
  : []),
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
367
  ...(p.lockfile && !p.checked
282
368
  ? ['- The lockfile did not refresh: run `pnpm install` after resolving, and commit the lockfile.']
283
369
  : []),
@@ -287,13 +373,21 @@ export function pullBody(p) {
287
373
  // Ready, there is nothing left to resolve: the same request without the condition.
288
374
  const settled = lockfile.length ? ['- Run `pnpm install`, and commit the lockfile if it changes.'] : [];
289
375
  const head = hand.length > 0
290
- ? `**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')}`
376
+ ? `**Needs a hand.** \`plx update\` marks this pull request ready once no tracked file holds a conflict marker, the root marker names the version, and the root \`${MISE_FILE}\` pins plx at it.\n\n${[...hand, ...lockfile].join('\n')}`
291
377
  : p.checked
292
- ? `Ready for review: no tracked file holds a conflict marker, and every site's answers record ${p.version}.${settled.length ? `\n\n${settled.join('\n')}` : ''}`
378
+ ? `Ready for review: no tracked file holds a conflict marker, the root marker names ${p.version}, and the root \`${MISE_FILE}\` pins plx at it.${settled.length ? `\n\n${settled.join('\n')}` : ''}`
293
379
  : 'Nothing needs a hand: every site merged clean.';
380
+ const kept = Object.entries(p.kept ?? {}).filter(([, paths]) => paths.length > 0);
294
381
  return [
295
382
  head,
296
- `Plexus ${p.version} (§ 1.5 PLX): \`copier update\` at ${p.sites.map(site).join(', ')}, the lockfile where manifests moved, and the workflow refs.`,
383
+ ...(kept.length > 0
384
+ ? [
385
+ `${KEPT(p.version)}; delete each that is no longer needed:\n${kept
386
+ .map(([s, paths]) => `- At ${site(s)}: ${paths.map(code).join(', ')}.`)
387
+ .join('\n')}`,
388
+ ]
389
+ : []),
390
+ `Plexus ${p.version} (§ 1.5 PLX): the templates at ${p.sites.map(site).join(', ')}, the version in the root marker, the lockfile where manifests moved, and the workflow refs.`,
297
391
  p.note,
298
392
  ].join('\n\n');
299
393
  }
@@ -301,29 +395,41 @@ export function pullBody(p) {
301
395
  const REVISITED = "Opened by `plx update`; rewritten by a later run from what it found at the branch's tip.";
302
396
  /**
303
397
  * The version branch's tip, read by hash: the detector over its tracked
304
- * files, and its sites, every answers file it holds that names a template,
305
- * each at the version or not. The lockfile is asked for where the tip holds
306
- * one and the pull request is not ready, or holds commits beyond the one plx
307
- * made (somebody resolved by hand), as the forge counts them (`aheadOf`).
398
+ * files, its sites, every marker it holds that lists at least one template,
399
+ * whether its root marker names the version and its `plx` pin too, and the
400
+ * kept files plx's commit names (`comparedAt`) that the tip still holds. The lockfile is asked for
401
+ * where the tip holds one and the pull request is not ready, or holds commits
402
+ * beyond the one plx made (somebody resolved by hand), as the forge counts
403
+ * them.
308
404
  */
309
405
  async function readTip(ctx, consumer, version, tip) {
310
406
  const repo = consumer.path;
311
407
  await fetchTip(ctx, repo, tip);
312
408
  const marked = await filesWithConflictMarkers(ctx, repo, tip);
313
- const { files, sites: held } = await sitesOfTree(ctx, repo, tip);
314
- const sites = held.map((s) => s.dir);
315
- const behind = held.filter((s) => s.answers?.commit !== version).map((s) => s.dir);
316
- const ready = marked.length === 0 && behind.length === 0;
317
- // Somebody pushed to the branch: more commits than the one plx made. Asked only when it decides something.
318
- const lockfile = files.includes('pnpm-lock.yaml') && (!ready || (await aheadOf(ctx, consumer, tip)) > 1);
319
- return { tip, sites, marked, behind, ready, lockfile };
409
+ const held = await findSites(ctx, repo, tip);
410
+ const sites = held.filter((s) => s.dir === '.' || (s.config?.templates?.length ?? 0) > 0).map((s) => s.dir);
411
+ const behind = held.find((s) => s.dir === '.')?.config?.version === version ? [] : ['.'];
412
+ const blob = (path) => ctx.read('git', ['cat-file', 'blob', `${tip}:${path}`], { cwd: repo }).catch(() => undefined);
413
+ const pin = pinGap(version, await blob(MARKER_FILE), await blob(MISE_FILE));
414
+ const ready = marked.length === 0 && behind.length === 0 && pin === undefined;
415
+ const lockfiled = await ctx.read('git', ['cat-file', '-e', `${tip}:pnpm-lock.yaml`], { cwd: repo }).then(() => true, () => false);
416
+ const compared = await comparedAt(ctx, consumer, tip);
417
+ // Somebody pushed to the branch: more commits than the one plx made.
418
+ const lockfile = lockfiled && (!ready || compared.ahead > 1);
419
+ // A kept file somebody has since deleted on the branch is no longer there to name.
420
+ const files = new Set((await ctx.read('git', ['ls-tree', '-r', '-z', '--name-only', tip], { cwd: repo })).split('\0').filter(Boolean));
421
+ const kept = Object.fromEntries(Object.entries(keptIn(compared.message))
422
+ .map(([dir, paths]) => [dir, paths.filter((p) => files.has(p))])
423
+ .filter(([, paths]) => paths.length > 0));
424
+ return { tip, sites, marked, behind, ...(pin ? { pin } : {}), kept, ready, lockfile };
320
425
  }
321
426
  /** What a later run found at the tip, as the run names it. */
322
427
  function foundAt(at, version) {
323
428
  const n = at.marked.length;
324
429
  const parts = [
325
430
  ...(n > 0 ? [`${n} file${n === 1 ? '' : 's'} still hold${n === 1 ? 's' : ''} conflict markers`] : []),
326
- ...(at.behind.length > 0 ? [`${at.behind.map(site).join(', ')} not at ${version}: copier did not run there`] : []),
431
+ ...(at.behind.length > 0 ? [`the root marker does not name ${version}`] : []),
432
+ ...(at.pin ? [pinSaid(at.pin, version)] : []),
327
433
  ];
328
434
  return parts.length > 0 ? parts.join('; ') : `no conflict marker remains, and every site is at ${version}`;
329
435
  }
@@ -338,12 +444,14 @@ export async function revisit(ctx, consumer, pull, version, tip) {
338
444
  const { path: repo, rel: name } = consumer;
339
445
  const branch = versionBranch(version);
340
446
  const at = await readTip(ctx, consumer, version, tip);
341
- const { marked, behind, ready } = at;
447
+ const { marked, behind, pin, ready } = at;
342
448
  const body = pullBody({
343
449
  version,
344
450
  sites: at.sites,
345
451
  marked,
346
452
  behind,
453
+ ...(pin ? { pin } : {}),
454
+ kept: at.kept,
347
455
  lockfile: at.lockfile,
348
456
  checked: true,
349
457
  note: REVISITED,
@@ -365,7 +473,14 @@ export async function revisit(ctx, consumer, pull, version, tip) {
365
473
  catch (error) {
366
474
  if (undo)
367
475
  ctx.say(line);
368
- return { url: pull.url, marked, behind, mergeable: false, failed: `pull request ${pull.url}: ${detailOf(error)}` };
476
+ return {
477
+ url: pull.url,
478
+ marked,
479
+ behind,
480
+ ...(pin ? { pin } : {}),
481
+ mergeable: false,
482
+ failed: `pull request ${pull.url}: ${detailOf(error)}`,
483
+ };
369
484
  }
370
485
  // A forge that refuses the draft leaves the pull request ordinary: what needs a hand keeps the run nonzero.
371
486
  if (undo)
@@ -375,7 +490,7 @@ export async function revisit(ctx, consumer, pull, version, tip) {
375
490
  });
376
491
  // A dry run left the state as it was.
377
492
  const draft = ctx.dryRun ? pull.draft : !ready;
378
- return { url: pull.url, marked, behind, mergeable: ready && !draft };
493
+ return { url: pull.url, marked, behind, ...(pin ? { pin } : {}), mergeable: ready && !draft };
379
494
  }
380
495
  /** The last line of a body a later run opened. */
381
496
  const OPENED_LATE = 'Opened by `plx update`: a later run found the branch on origin with no pull request.';
@@ -390,12 +505,15 @@ export async function openLate(ctx, consumer, version, reviewers, tip) {
390
505
  const { path: repo, rel: name } = consumer;
391
506
  const branch = versionBranch(version);
392
507
  const at = await readTip(ctx, consumer, version, tip);
393
- const { marked, behind, ready } = at;
508
+ const { marked, behind, pin, ready } = at;
509
+ const gap = pin ? { pin } : {};
394
510
  const state = {
395
511
  version,
396
512
  sites: at.sites,
397
513
  marked,
398
514
  behind,
515
+ ...gap,
516
+ kept: at.kept,
399
517
  lockfile: at.lockfile,
400
518
  checked: true,
401
519
  note: OPENED_LATE,
@@ -409,23 +527,21 @@ export async function openLate(ctx, consumer, version, reviewers, tip) {
409
527
  catch (error) {
410
528
  const why = detailOf(error);
411
529
  ctx.say(` ✗ FAILED — pull request${why ? `: ${why}` : ''}`);
412
- return { marked, behind, ready, failed: `pull request: ${why}` };
530
+ return { marked, behind, ...gap, ready, failed: `pull request: ${why}` };
413
531
  }
414
532
  if (ctx.dryRun) {
415
533
  ctx.say(` (preview) ${name}: would open a pull request of ${branch} against ${consumer.branch}`);
416
- return { marked, behind, ready, previewed: true };
534
+ return { marked, behind, ...gap, ready, previewed: true };
417
535
  }
418
536
  const pull = await pullOf(ctx, consumer, repo, version);
419
537
  if (!pull)
420
- return { marked, behind, ready, failed: 'pull request: the forge did not list it after opening it' };
538
+ return { marked, behind, ...gap, ready, failed: 'pull request: the forge did not list it after opening it' };
421
539
  ctx.say(`• ${name}: ${draft ? 'draft ' : ''}pull request opened: ${pull.url}`);
422
- // Unless named, from the root answers as the branch has them.
540
+ // Unless named, from the root marker as the branch has it.
423
541
  const from = reviewers ?? {
424
- answersFile: await ctx
425
- .read('git', ['cat-file', 'blob', `${at.tip}:${ANSWERS_FILE}`], { cwd: repo })
426
- .catch(() => ''),
542
+ marker: await ctx.read('git', ['cat-file', 'blob', `${at.tip}:${MARKER_FILE}`], { cwd: repo }).catch(() => ''),
427
543
  };
428
544
  const review = await askForReviews(ctx, name, pull, from, repo);
429
- return { pull, marked, behind, ready, ...(review ? { review } : {}) };
545
+ return { pull, marked, behind, ...gap, ready, ...(review ? { review } : {}) };
430
546
  }
431
547
  //# sourceMappingURL=pull.js.map