@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/summary.js CHANGED
@@ -1,8 +1,93 @@
1
- // The summary of a run that takes a version in one or more repos (update,
2
- // propagate) or previews one (the dry run of `plx-dev ship`), rendered for a
3
- // human: one line per site, the pull requests, the line that merges the clean
4
- // ones, then the verdict. Every tool that prints a Summary prints it this way.
5
- import { isClean } from "./take.js";
1
+ // The summary of a run that takes a version in one or more repos (`update`,
2
+ // `update --recursive`) or previews one (the dry run of `plx-dev ship`): what
3
+ // each repo's run came to (`Outcome`, update.ts), folded into lists by
4
+ // `summarize` at the edge, where the run is rendered, and rendered for a
5
+ // human: one line per site, the pull requests, the line that merges the
6
+ // clean ones, then the verdict. Every tool that prints a Summary prints it
7
+ // this way.
8
+ import { versionBranch } from "./pull.js";
9
+ import { needsHand } from "./take.js";
10
+ /** A repo's file as the run names it: under the repo's name, `.` for a repo run from inside. */
11
+ const inRun = (repo, file) => (repo === '.' ? file : `${repo}/${file}`);
12
+ /** True when nothing in the summary needs a human but the pull requests. */
13
+ export const isClean = (s) => s.conflicted.length === 0 && s.failed.length === 0 && s.skipped.length === 0;
14
+ /**
15
+ * The summary of what the repos' runs came to, in their order. Its version is
16
+ * the one given, else the first a run names.
17
+ */
18
+ export function summarize(outcomes, preview, version = outcomes.find((o) => o.version)?.version ?? '') {
19
+ const s = {
20
+ version,
21
+ preview,
22
+ clean: [],
23
+ conflicted: [],
24
+ failed: [],
25
+ skipped: [],
26
+ resting: [],
27
+ pulls: [],
28
+ mergeable: [],
29
+ opening: [],
30
+ };
31
+ for (const o of outcomes) {
32
+ switch (o.kind) {
33
+ case 'current':
34
+ break;
35
+ case 'skipped':
36
+ s.skipped.push({ path: o.repo, reason: o.reason });
37
+ break;
38
+ case 'resting':
39
+ s.resting.push({ path: o.repo, reason: o.reason });
40
+ break;
41
+ case 'failed':
42
+ s.failed.push(o.repo);
43
+ break;
44
+ case 'found':
45
+ // Files that still hold markers need a human, like a conflicted site.
46
+ for (const file of o.marked)
47
+ s.conflicted.push(inRun(o.repo, file));
48
+ // A site copier did not run at needs a human to run it.
49
+ for (const site of o.behind)
50
+ s.failed.push(`${site === '.' ? o.repo : inRun(o.repo, site)} (not at ${o.version})`);
51
+ if (o.failed !== undefined)
52
+ s.failed.push(o.repo);
53
+ if (o.pull)
54
+ s.pulls.push(o.pull);
55
+ if (o.opening)
56
+ s.opening.push(`${o.repo} ${versionBranch(o.version)}`);
57
+ if (o.pull && o.mergeable)
58
+ s.mergeable.push(o.pull);
59
+ if (o.review && 'failed' in o.review)
60
+ s.failed.push(`${o.repo} (review request)`);
61
+ break;
62
+ case 'taken': {
63
+ const t = o.taken;
64
+ for (const site of t.sites)
65
+ s[site.outcome].push(site.rel);
66
+ // A file that holds a marker makes the pull request a draft too: listed
67
+ // unless a conflicted site it lies in says so already.
68
+ const conflicted = t.sites.filter((x) => x.outcome === 'conflicted').map((x) => x.rel);
69
+ for (const file of t.marked ?? []) {
70
+ const path = inRun(t.rel, file);
71
+ if (!conflicted.some((site) => site === '.' || path === site || path.startsWith(`${site}/`)))
72
+ s.conflicted.push(path);
73
+ }
74
+ if (t.lockfile === 'failed')
75
+ s.failed.push(`${t.rel}/pnpm-lock.yaml`);
76
+ if (t.failed !== undefined)
77
+ s.failed.push(t.rel);
78
+ if (t.pull)
79
+ s.pulls.push(t.pull.url ?? `${t.rel} ${t.pull.branch}`);
80
+ if (t.pull?.url && !t.pull.draft && !needsHand(t))
81
+ s.mergeable.push(t.pull.url);
82
+ // The pull request stands; who was to review it needs a human to ask.
83
+ if (t.review && 'failed' in t.review)
84
+ s.failed.push(`${t.rel} (review request)`);
85
+ break;
86
+ }
87
+ }
88
+ }
89
+ return s;
90
+ }
6
91
  /**
7
92
  * One line to paste that merges the given pull requests, each with a merge
8
93
  * commit and its branch deleted: `gh pr merge -md -R <org>/<repo> <number>`,
@@ -16,7 +101,7 @@ export function mergeLine(urls) {
16
101
  .join(' && ');
17
102
  }
18
103
  /** The summary: one line per site, the pull requests, then the verdict. */
19
- export function renderSummary(s, realCommand, verb = 'propagate') {
104
+ export function renderSummary(s, realCommand, verb = 'update') {
20
105
  const lines = ['── summary ──────────────────────────────────────────────────────────────'];
21
106
  for (const p of s.clean)
22
107
  lines.push(` ✓ clean: ${p}`);
@@ -30,12 +115,14 @@ export function renderSummary(s, realCommand, verb = 'propagate') {
30
115
  lines.push(` • resting: ${path} (${reason})`);
31
116
  for (const url of s.pulls)
32
117
  lines.push(` → pull: ${url}`);
118
+ for (const branch of s.opening)
119
+ lines.push(` → to open: ${branch}`);
33
120
  const merge = s.preview ? '' : mergeLine(s.mergeable);
34
121
  if (merge)
35
122
  lines.push(' the clean ones, to merge once their checks pass:', ` ${merge}`);
36
123
  const clean = isClean(s);
37
- // A run that took no version (resting, already there, its branch on origin already) has nothing to run for real.
38
- const idle = clean && s.clean.length === 0;
124
+ // A run that took no version and opens nothing (resting, already there, its pull request found) has nothing to run for real.
125
+ const idle = clean && s.clean.length === 0 && s.opening.length === 0;
39
126
  if (s.preview && !idle) {
40
127
  lines.push(' (preview only — nothing was changed)');
41
128
  if (clean)
@@ -1 +1 @@
1
- {"version":3,"file":"summary.js","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EA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KAAK,CAAC,CAAC;IACrE,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QACrD,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,sCAAsC,WAAW,EAAE,CAAC,CAAC;IAC7E,CAAC;SAAM,IAAI,KAAK,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC;IAC9G,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,4DAA4D,IAAI,EAAE,CAAC,CAAC;IAC3F,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/dist/take.d.ts CHANGED
@@ -1,59 +1,70 @@
1
- import type { Consumer } from './consumers.ts';
1
+ import type { Consumer, Site } from './consumers.ts';
2
2
  import type { Context } from './context.ts';
3
- export interface Summary {
4
- version: string;
5
- /** True for a dry run: nothing in the workspace changed. */
6
- preview: boolean;
7
- /** Sites, relative to the workspace. */
8
- clean: string[];
9
- conflicted: string[];
10
- /** Sites whose update exited nonzero, consumers that could not be cloned or pushed, and lockfiles that failed to refresh. */
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 updated, one per consumer that changed. */
23
- pulls: string[];
24
- /** Those of `pulls` whose repo merged clean at every site and failed nowhere: ready to merge once their checks pass. */
25
- mergeable: string[];
3
+ import { type Review, type Reviewers } from './pull.ts';
4
+ /** What became of one site: merged clean, left with conflicts, or its copier run failed (`detail` says why). */
5
+ export interface SiteResult {
6
+ rel: string;
7
+ outcome: 'clean' | 'conflicted' | 'failed';
8
+ detail?: string;
9
+ }
10
+ /** What one consumer's taking of the version came to, as data: the caller folds it into a summary. */
11
+ export interface Taken {
12
+ rel: string;
13
+ /** Every site, in the order they were updated. */
14
+ sites: SiteResult[];
15
+ /** The lockfile refresh, where manifests moved; undefined when nothing needed one. */
16
+ lockfile?: 'refreshed' | 'failed';
17
+ /** Tracked files of the scratch checkout that hold a conflict marker once the sites are updated. */
18
+ marked?: string[];
19
+ /** The pull request opened, a draft when something needs a hand and the forge took one; its URL unknown when the forge did not say it. */
20
+ pull?: {
21
+ branch: string;
22
+ url?: string;
23
+ draft: boolean;
24
+ };
25
+ /** Why the commit, the push or the pull request failed, when one did. */
26
+ failed?: string;
27
+ /** The users asked to review the pull request, or why asking them failed. */
28
+ review?: Review;
26
29
  }
27
- /** True when nothing in the summary needs a human but the pull requests. */
28
- export declare const isClean: (s: Summary) => boolean;
29
- /** Add what one repo's run found to the summary of a run over many. */
30
- export declare function mergeSummary(into: Summary, from: Summary): void;
31
- export declare const emptySummary: (version: string, preview: boolean) => Summary;
32
- /** What a pull request's body says when nothing in it needs a hand; read back to tell a clean one found on origin. */
33
- export declare const CLEAN_BODY = "Merged clean at every site.";
34
- export declare const versionBranch: (version: string) => string;
35
- /** How a consumer takes the version: the knobs the preview and update set differently. */
30
+ /** Whether the consumer needs a hand beyond reviewing its pull request. */
31
+ export declare const needsHand: (t: Taken) => boolean;
32
+ /**
33
+ * How a site is brought to the version in the scratch checkout: `target` is
34
+ * the site's directory there, `dir` the checkout's root. The default runs
35
+ * copier against the published template; the maintainers' preview of an
36
+ * unreleased version (preview.ts of @plexus-ms/dev) brings its own, against
37
+ * the local template checkouts. Whatever it leaves is then judged and
38
+ * staged the same way.
39
+ */
40
+ export type SiteUpdate = (ctx: Context, site: Site, target: string, dir: string) => Promise<void>;
41
+ /** How a consumer takes the version. */
36
42
  export interface Take {
37
43
  version: string;
38
- /**
39
- * Preview from the local template checkouts under this upstream directory at
40
- * main (preview.ts of @plexus-ms/dev), instead of the published template.
41
- */
42
- previewFrom?: string;
43
- /** The template ref copier updates to; unset, copier takes the newest tag, which the version just cut. */
44
+ /** The template ref copier updates to; unset, copier takes the newest tag. */
44
45
  ref?: string;
45
46
  /** Who opened the pull request, named in its body. */
46
47
  opener: string;
47
48
  /** Why the repo takes the version now (need.ts), named in the body beside the opener. */
48
49
  why?: string;
50
+ /** How each site is updated; default: copier against the published template, at `ref`. */
51
+ update?: SiteUpdate;
52
+ /** Who is asked to review the pull request when it is opened; default: the root answers' `pr_reviewers` after copier ran. */
53
+ reviewers?: Reviewers;
49
54
  }
55
+ /**
56
+ * copier at the version plx pins, through mise, with the consumer's own mise
57
+ * config ignored: copier needs no project tool, and a root `mise.toml` left
58
+ * with conflict markers by the root site's update would otherwise fail every
59
+ * later mise call in the directory, the apps' updates first of all.
60
+ */
61
+ export declare const copierIn: (dir: string, args: string[]) => [string, string[]];
50
62
  /**
51
63
  * One consumer takes the version in `dir`, a scratch checkout of its branch:
52
64
  * every site updated, the lockfile refreshed, the workflow refs bumped, then
53
65
  * the commit, the branch and the pull request.
54
66
  */
55
- export declare function takeVersion(ctx: Context, consumer: Consumer, dir: string, take: Take, summary: Summary): Promise<void>;
56
- /** The URL of the open pull request from the version branch against the consumer's branch, if any. */
57
- export declare function openPullUrl(ctx: Context, consumer: Consumer, dir: string, version: string): Promise<string>;
58
- export declare const detail: (error: unknown) => string;
67
+ export declare function takeVersion(ctx: Context, consumer: Consumer, dir: string, take: Take): Promise<Taken>;
68
+ /** A commit of plain plumbing on a scratch checkout: unsigned, no hooks, a stand-in identity. */
69
+ export declare const scratchCommit: (ctx: Context, dir: string, message: string) => Promise<string | undefined>;
59
70
  //# sourceMappingURL=take.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"take.d.ts","sourceRoot":"","sources":["../src/take.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,gBAAgB,CAAC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